4 ms·
> Rust didn't put integer overflow checks in release mode because current CPU don't provide "free" integer overflow detection Not really; the main performance
by 0815test 7y ago
> Rust didn't put integer overflow checks in release mode because current CPU don't provide "free" integer overflow detection
Not really; the main performance drawback of obligate overflow checks is excessively-constrained semantics of the resulting code making optimization harder, not the direct CPU cost of checking. There are other ways of detecting possible overflows, and Rust does check for overflow in debug mode (this is specifically in order to ensure that most Rust code will work properly even when checks are enabled, and will not simply end up relying on underspecified semantics.)
- renox 7y agoInteresting, do you have studies on this topic? That said the 'CPU costs' of adding these branch are mostly ICache usage cost so benchmarks aren't very useful..