Your l
is a non-constant global variable, so you need to interpolate it into the benchmark: @btime ($l)()
(see: GitHub - JuliaCI/BenchmarkTools.jl: A benchmarking framework for the Julia language)
2 Likes