5 ms·
Apple has actually measured the impact of adding bounds checking to commonly used libraries including media libraries and found no impact on overall power use.
by chlorion 3y ago
Apple has actually measured the impact of adding bounds checking to commonly used libraries including media libraries and found no impact on overall power use. Audio and video encoding libraries took around a 1% performance impact.
https://llvm.org/devmtg/2023-05/slides/TechnicalTalks-May11/01-Na-fbounds-safety.pdf https://llvm.org/devmtg/2023-05/slides/TechnicalTalks-May11/...
I don't think there is any evidence to support that bounds checking causes any significant increase in power consumption, and measurements currently available such as shown above show minimal runtime performance impact.
Bounds checking is the perfect situation for branch predictors, 99.9% of the time the branch is predicted correctly, and when it's not it doesn't matter because you're probably aborting the program!
There's also the point that you can opt out of bounds checking as-needed on hot loops if you really need to.
There is no technological reason to not use bounds checking as the default mode of operation today.
- pjmlp 3y agoThere is no technological reason to not use bounds checking as the default mode of operation since ALGOL exists. My favourite quote, C.A.R Hoare's "The 1980 ACM Turing Award Lecture" "A consequence of this principle is that every occurrence of every subscript of every subscripted variable was on every occasion checked at run time against both the upper and the lower declared bounds of the array. Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to--they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980 language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law." -- https://www.labouseur.com/projects/codeReckon/papers/The-Emperors-Old-Clothes.pdf https://www.labouseur.com/projects/codeReckon/papers/The-Emp...