> Beating the compiler at signed 32-bit division > 31 October 2026 路 10 min > Di...
DougMerritt (log馃槄 = 馃挧log馃槃) @dougmerritt@mathstodon.xyz
> Beating the compiler at signed 32-bit division
> 31 October 2026 路 10 min
> Dividing integers is slow on our processors. A 32-bit division costs:
[ table showing 7-12 cycles, depending ]
https://lemire.me/blog/2026/10/31/beating-the-compiler-at-signed-32-bit-division/
And that's 32 bit, not 64, which it goes on to point out is even slower.
People forget that not all instructions are ~1 cycle.
Lemire, the author, is "sans peur et sans reproche" on the subject of algorithmic efficiency.