-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve code generation for homogenous tuples of unknown length
E.g.: ``` mutable struct foo x::Int end mutable struct bar tup::NTuple{N, foo} where N end function f(b::bar) sum = 0 for i = 1:2 @inbounds sum += b.tup[i].x end sum end global x = bar((foo(1),foo(2))) @benchmark f(x::bar) ``` Before: ``` julia> @benchmark f(x::bar) BenchmarkTools.Trial: memory estimate: 0 bytes allocs estimate: 0 -------------- minimum time: 27.124 ns (0.00% GC) median time: 28.771 ns (0.00% GC) mean time: 29.864 ns (0.00% GC) maximum time: 116.762 ns (0.00% GC) -------------- samples: 10000 evals/sample: 995 ``` After: ``` BenchmarkTools.Trial: memory estimate: 0 bytes allocs estimate: 0 -------------- minimum time: 10.531 ns (0.00% GC) median time: 10.559 ns (0.00% GC) mean time: 10.610 ns (0.00% GC) maximum time: 122.751 ns (0.00% GC) -------------- samples: 10000 evals/sample: 999 time tolerance: 5.00% memory tolerance: 1.00% ```
- Loading branch information
Showing
3 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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