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

> Indexing into an array adds bounds checks which takes non-zero time.

* When done in such a way that the compiler cannot know the access is in-bounds. The same code in C would also need to perform bounds checks on access. If you do the same assertion you would in C checking that the indices are always less than the length, then Rust will not perform the bounds check because it detects it's unnecessary. Leveraging iterators is one idiomatic way of avoiding those bounds checks.



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

Search: