Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Hardening libc++ resulted in an average 0.30% performance impact

Maybe what really happened is that compiler technology has improved such that they are able to remove most redundant checks, such that it only costs 0.30% today. I can imagine things going the opposite direction 20 years ago, as in "we removed some bounds checks and gained X% of performance".



Probably yes, and branch prediction improved a lot since then, too. Bounds checks are easily predictable.


Bounds checking feels to me like low hanging fruit for a processor designer. A low cost operation that can run in parallel or tossed away as the steam from the instruction decoder gets optimized and scheduled.

Meanwhile the guys on the standards committee thinks of fixed width RISC instructions being executed by jungle logic and the ALU.


the hard part about bounds checks is you need very specific semantics for bounds errors to prevent them from preventing vectorization. specifically, you don't want to promise that they are thrown when they are executed


> preventing vectorization

No one that wants to emit vectorized code is relying on auto-vectorization to emit that code.


Unfortunately for many use cases like gamedev, debug builds need to be fast too. So hopefully more of the improvement is from branch prediction.


Bounds checks are trivially predictable though, I would hope code density was the issue rather than branch prediction.

And as others note, bounds checking was the norm before the STL.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: