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

> Particulary, Rust is able to optimize out some bound checks.

It doesn’t optimise out the bounds checks. I checked the assembly.

Bounds checks in rust always look so ugly if you look at the assembly output because there’s all this panic string building and whatnot. But in practice, I think it’s just that modern CPUs have excellent branch prediction. A branch that follows the same path 100% of the time is cheap. Especially when it has UNLIKELY() annotation hints in the code. This is the case for bounds checks. They just don’t really show up in benchmarks as much you’d think.



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

Search: