On 2026-04-02 16:32, Eric Blake wrote:
I think benchmarks can demonstrate that divisions are slower than multiplies.
Yes, my impression (without actually measuring) is that on recent Intel desktop CPUs, 64-bit integer multiplication has a latency of 3 cycles and a throughput of 3 multiplications per cycle, whereas 64-bit integer division is microcoded and non-pipelined and has a latency of 14-45 cycles with a reciprocal throughput is about equal to that latency.
If you're just doing an odd division here or there I expect it'll be hard to measure the difference. But if you're doing a ton of divisions you'll still notice, even with today's CPUs.
