4 ms·
Rusts bounds checking is done at compile time, so you don't need to turn it off.
by antiframe 3y ago
Rusts bounds checking is done at compile time, so you don't need to turn it off.
- flooow 3y agoIncorrect. Semantically, Rust always inserts runtime bounds-checks, regardless of optimization level. The compiler _may_ then remove them as part of an optimization pass, iff it can prove the check is redundant. Do bounds checks even matter, even for very tight loops? This article [1] seems to suggest that removing the checks can give up to 10-15% speed increase under some circumstances. Worth it? I'd say no. [1] https://dropbox.tech/infrastructure/lossless-compression-with-brotli https://dropbox.tech/infrastructure/lossless-compression-wit...
- pjmlp 3y agoAnd runtime as well, like in any memory safe language.