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

I agree that an early exit would be better, but it's hardly a "killer".

Assuming a uniform distribution of items searched for, 50% of them will require a full search, and 75% will exit one iteration early. 100% of searches for missing items will require a full search.

Secondly, the last couple of items are likely to be cache hits anyway, since adjacent array entries are in adjacent memory.



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

Search: