mbauman
December 18, 2024, 5:06pm
3
One of my all-time favorite threads here was @foobar_lv2 ’s deep dive into how much different branch predictors can “learn” and remember during microbenchmarks:
Something to keep in mind when running microbenchmarks: The sneaky CPU can remember astoundingly long branch history patterns. If you run @btime on somthing, then you generate a periodic branching pattern: The period length is the size of your benchmark, and it is repeated very often by the benchmark loop. This is because @btime runs your code multiple times and then averages the timings, because we don’t get clock with cycle-precision.
This can spoil benchmarks and has affected some BaseBenchm…