Chairmarks.jl

The new package looks great! However, I’m getting confused when I compare the results to BenchmarkTools.jl for microbenchmarks. Here is an example, inspired by this thread:

f(x, n) = x << n
g(x, n) = x << (n & 63)

On my laptop I get

julia> x = UInt128(1); n = 1;
julia> @btime f($x, $n);
  4.371 ns (0 allocations: 0 bytes)
julia> @b f($x, $n)
1.341 ns
julia> @btime g($x, $n);
  2.736 ns (0 allocations: 0 bytes)
julia> @b g($x, $n)
1.341 ns

It’s not just that the absolute timings are different. According to @btime, g is faster than f, but @b doesn’t see any difference. How come?

1 Like