3 ms·
I think the other thing that changed is that branch predictors are roughly infinitely times better than they were in 1980. The is-this-subscript-ok check should
by minimax 11y ago
I think the other thing that changed is that branch predictors are roughly infinitely times better than they were in 1980. The is-this-subscript-ok check should be easily predictable and I wonder if these checks even cost anything in a hot loop on a modern CPU.
- kevingadd 11y agoThey have a measurable cost, and performance-obsessed developers/users hate the cost. But it's a lot smaller than it used to be, and modern compiler/JIT research is yielding ways to safely eliminate/hoist a lot of the checks.
- pjmlp 11y agoAfter Z80 and Sinclair Basic, my next languages were GW-Basic, Turbo Basic and Turbo Pascal, followed by many others. The Borland languages like many other that allowed for system programming in those days, allowed for disabling bounds checking, as Borland customers weren't like Hoare ones. I never felt the need to disable them. Yes they did had a few ms to the program execution, but nothing that would impact the user experience of the application. This is one of the biggest problem in our industry, specially among C and its derived languages (C++, Objective-C), to micro-optimize each code line without any sort of measurement how it impacts the final application. Of course there are cases where it really matters, like HPC, games and such, but those are a tiny portion of the software that gets written every day.