On 11-04-16 4:20 AM, Andreas Gal wrote:

Based on the experience with the tracer, overflow checks aren't really crazy 
expensive and we can optimize them quite well. It probably depends on how well 
LLVM understands them. I know it has intrinsics for it.

The checks themselves are not that expensive, and yes llvm has intrinsic for it.

The problem is that they have some hidden costs. Assuming no overflows makes it easier for the compiler to compute loop trip counts for example.

In the particular case of rust, there is an extra cost too for what it is meant to "fail". If an "a+b" that overflows should have the same effect as the fail statement, we would have to insert code to start an stack unwind. It also means that very basic math only functions can throw.

Andreas

Cheers,
Rafael
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to