BenchmarkTools.jl
BenchmarkTools.jl copied to clipboard
`setup`/`teardown` doesn't allow multiple assignment syntax inside Tuple
julia> using BenchmarkTools
# this should work, but doesn't
julia> @benchmark (a + b + c) setup=(a,b,c=1,2,3)
ERROR: syntax: assignment not allowed inside tuple
in generate_benchmark_definition(::Module, ::Array{Symbol,1}, ::Array{Symbol,1}, ::Expr, ::Expr, ::Void, ::BenchmarkTools.Parameters) at /Users/jarrettrevels/.julia/v0.5/BenchmarkTools/src/execution.jl:282
julia> @benchmark (a + b + c) setup=begin a,b,c=1,2,3 end
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 1.645 ns (0.00% GC)
median time: 1.962 ns (0.00% GC)
mean time: 1.967 ns (0.00% GC)
maximum time: 4.511 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 1000
time tolerance: 5.00%
memory tolerance: 1.00%
It might be the case that we can't easily "fix" this due to how things parse, so the action item here is to change the documentation to use begin...end
instead of parens for setup
/teardown
delimiters.