Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's not that simple either - normally, if you're doing some loops over a large array of pixels, say, to perform some operation to them, there will only be a couple of bounds checks before the loop starts, checking the starting and ending conditions of the loops, not re-doing the bounds check for every pixel.

So very rarely should it be anything like 3-4x the cost, though some complex indexing could cause it to happen, I suppose. I agree scopes are a decent way to handle it!



You’re describing a situation where I - or a very smart compiler can choose when to bounds check or not to make that intelligent realization.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: