News for hackers. Stuff that matters.
Re:Triangle frenzy by physicsguy on Sunday May 08, 2022 @04:45AM (#31302325)
If you add bounds checking, then what happens is that on every index into the array, a line of code gets called that says "is the index the user specified less than the length of the array". On it's own, that's not a problem, but when you're doing this repeatedly millions of times, it's a performance killer.
Re:Triangle frenzy by Athas on Sunday May 08, 2022 @08:32AM (#31303453)
Still, I would expect the overhead to be moderate, not a killer.
Re:Triangle frenzy by ChrisRackauckas on Sunday May 08, 2022 @09:48AM (#31303931)
Bounds checking can block the ability to auto-generate SIMD, which then has a larger effect than the operations of the bounds checking itself.