4 ms·
> 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
by omoikane 2y ago
> 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".
- panstromek 2y agoProbably yes, and branch prediction improved a lot since then, too. Bounds checks are easily predictable.
- Gibbon1 2y agoBounds 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.
- adgjlsfhk1 2y agothe 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
- almostgotcaught 2y ago> preventing vectorization No one that wants to emit vectorized code is relying on auto-vectorization to emit that code.
- masklinn 2y agoBounds 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.
- cma 2y agoUnfortunately for many use cases like gamedev, debug builds need to be fast too. So hopefully more of the improvement is from branch prediction.