feat(types): make TernaryHV parametric over integer type#54
Merged
cvigilv merged 1 commit intoKermit-UGent:mainfrom Mar 23, 2026
Merged
feat(types): make TernaryHV parametric over integer type#54cvigilv merged 1 commit intoKermit-UGent:mainfrom
cvigilv merged 1 commit intoKermit-UGent:mainfrom
Conversation
Collaborator
cvigilv
commented
Mar 23, 2026
- Refactor TernaryHV to be parametric over integer type (T <: Integer)
- Add inner and outer constructors for type inference and conversion
- Provide type-specific constructors for TernaryHV{T}
- Update helper methods (copy, similar, normalize) to preserve type parameter
- Update tests to cover TernaryHV with various integer types
- Refactor TernaryHV to be parametric over integer type (T <: Integer)
- Add inner and outer constructors for type inference and conversion
- Provide type-specific constructors for TernaryHV{T}
- Update helper methods (copy, similar, normalize) to preserve type parameter
- Update tests to cover TernaryHV with various integer types
Collaborator
Author
|
Mini benchmark: julia> for T in (Int8, Int16, Int32, Int64)
println("Benchmarking with $T")
H = [TernaryHV{T}() for _ in 1:10]
@show @benchmark sum($H)
@show @benchmark prod($H)
println()
end
Benchmarking with Int8
#= REPL[7]:4 =# @benchmark(sum($(Expr(:$, :H)))) = Trial(4.655 μs)
#= REPL[7]:5 =# @benchmark(prod($(Expr(:$, :H)))) = Trial(2.729 μs)
Benchmarking with Int16
#= REPL[7]:4 =# @benchmark(sum($(Expr(:$, :H)))) = Trial(8.541 μs)
#= REPL[7]:5 =# @benchmark(prod($(Expr(:$, :H)))) = Trial(5.479 μs)
Benchmarking with Int32
#= REPL[7]:4 =# @benchmark(sum($(Expr(:$, :H)))) = Trial(17.209 μs)
#= REPL[7]:5 =# @benchmark(prod($(Expr(:$, :H)))) = Trial(11.667 μs)
Benchmarking with Int64
#= REPL[7]:4 =# @benchmark(sum($(Expr(:$, :H)))) = Trial(36.667 μs)
#= REPL[7]:5 =# @benchmark(prod($(Expr(:$, :H)))) = Trial(27.541 μs)This is useful for optimizing bigger experiments. |
Collaborator
Author
|
Immediately merging this as I think it is a trivial addition. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.