Time to move std.experimental.checkedint to std.checkedint ?

Elronnd elronnd at elronnd.net
Wed Mar 31 04:28:28 UTC 2021


On Saturday, 27 March 2021 at 03:25:04 UTC, Walter Bright wrote:
> 4. fast integer arithmetic is fundamental to fast code, not a 
> mere micro-optimization. Who wants an overflow check on every 
> pointer increment?

Dan Luu measures overflow checks as having an overall 1% 
performance impact for numeric-heavy c code.  
(https://danluu.com/integer-overflow/).  The code size impact is 
also very small, ~3%.

This isn't 'speculation', it's actual measurement.  'lea' is a 
microoptimization, it doesn't 'significantly' improve 
performance; yes, mul is slow, but lea can be trivially replaced 
by the equivalent sequence of shifts and adds with very little 
penalty.

Why is this being seriously discussed as a performance pitfall?


More information about the Digitalmars-d mailing list