Hacker News new | past | comments | ask | show | jobs | submit login

Trivially, anything using the Iterator trait.

I don't know that I've ever actually manually indexed an array over years of using Rust.




In the HPC / offline graphics / simulation world, there's lots of things like sparse arrays / grids, where you index into compacted grids and iterators wouldn't be that practical in that scenario (i.e. one single item, although for things like filtering with surrounding cells they can still be useful sometimes), and bounds checks do make a bit of a difference there (it's definitely measureable above the noise threshold), and due to the random nature of the data, the branch predictors don't help avoid the overhead.


Sure, I know there's paradigms where manual indexing is important. GP asked for an example where bounds-checking could be eliminated in Rust, so I gave the first one I thought of.


I don't think your answer is relevant to the question:

> Can you point to any such bounds check in C




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

Search: