3 ms·
I just benchmarked the three versions (in Rust, with criterion) on my Coffee Lake CPU. The quartiles are: Naive version, best case: [481.40 ps 487.84 ps 494.56
by pcwalton 2y ago
I just benchmarked the three versions (in Rust, with criterion) on my Coffee Lake CPU. The quartiles are:
Naive version, best case: [481.40 ps 487.84 ps 494.56 ps]
Naive version, mid case: [751.56 ps 758.84 ps 766.17 ps]
Naive version, worst case: [953.71 ps 970.95 ps 994.65 ps]
Packed bitfield version: [685.98 ps 698.25 ps 711.57 ps]
So on average, the naive version and packed bitfield versions are within 10% of one another. Modern CPUs frequently don't benefit much from these kinds of tricks anymore.