3 ms·
The cost of bounds checking is very manageable with modern CPUs and compilers. (I guess the bounds checks execute in parallel with the cache lookup into the arr
by gcp 10y ago
The cost of bounds checking is very manageable with modern CPUs and compilers. (I guess the bounds checks execute in parallel with the cache lookup into the array).
Firefox now uses it in release builds (for vector-like objects) for security reasons, and IIRC there was no real performance impact.
- pjmlp 10y agoEven back in the Algol 60 days, it was manageable. "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." -- C. A. R. Hoare, Turing award lecture in 1980, http://cacm.acm.org/magazines/1981/2/10949-the-emperors-old-clothes/pdf http://cacm.acm.org/magazines/1981/2/10949-the-emperors-old-...