3 ms·
Bound checks are entirely avoidable if you can prove that all your calls are within bounds - this being the key part of my comment. If you can’t, you just rewr
by StopDisinfo910 1y ago
Bound checks are entirely avoidable if you can prove that all your calls are within bounds - this being the key part of my comment.
If you can’t, you just rewrite your code so you can because your code is not safe otherwise and safe code is what we are discussing here.
Note that all calls can trivially be made provably within bounds by explicitly bound checking yourself and providing an alternate path for out of bound calls which obviously doesn’t improve performances compared to bound checks inserted by the compiler but at least save you a panic in the worst case scenario.