I don’t know if you have a Julia startup file but it might be doing something different for your REPL session. Also you want to benchmark code without it, and I wish it were not on by default for scripts, but people don’t agree…
I did:
GC.gc(true) # Note, I think not needed, implied by @btime?
julia> @benchmark MA.buffered_operate_to!(b, o, dot, x, y) setup=(o=BigFloat(); n=50; x=rand(BigFloat,n); y=rand(BigFloat,n); b=MA.buffer_for(dot,typeof(x),typeof(y));)
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
Range (min … max): 12.903 μs … 67.682 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 13.901 μs ┊ GC (median): 0.00%
Time (mean ± σ): 14.429 μs ± 2.732 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
And with @btime I got (which shows median):
$ julia --startup-file=no julia_ma_dot_bench.jl
13.133 μs (0 allocations: 0 bytes)
I tried to use @benchmark from a script but I get no output then… even without the ; to not suppress output (in the REPL).
I think @btime shows the minimum time, not median, from the docs
… @btime prints the minimum time and memory allocation before returning the value of the expression …
The print from @benchmark seems to just be the returned object being shown, so maybe if you just wrapped th benchmark in a print it would work in a script as well?