Hacker News new | ask | show | jobs
by dathinab 1302 days ago
In some very hot code (most times loops with math stuff were it prevents some optimizations and/or the compiler fails to eliminate it) it can lead to relevant performance improvements.

Because of this you might find some rust code which opts out of bounds check for such code using unsafe code.

But this code tends to be fairly limited and often encapsulated into libraries.

So I agree that for most code doing so is just plain stupid. In turn I believe doing it on a program or compilation unit level (instead of a case by case basis) is (nearly) always a bad idea.