#How to get legitimate micro-benchmark timings in Zig
1 messages · Page 1 of 1 (latest)
The modification of the sample was an attempt to make it so the optimizer couldn't think the calculation was redundant
Might help to see how you're using std.time.Timer.
Using https://github.com/karlseguin/zul/blob/master/src/benchmark.zig which is just a wrapper around std.time.Timer, I get:
crc24
9870087 iterations 298.61ns per iterations
0 bytes per iteration
worst: 459ns median: 292ns stddev: 21.28ns
crc24Openpgp
27482973 iterations 108.92ns per iterations
0 bytes per iteration
worst: 250ns median: 125ns stddev: 23.41ns
noop
101440083 iterations 29.15ns per iterations
0 bytes per iteration
worst: 209ns median: 41ns stddev: 20.33ns