4 ms·
Unsafe does not imply fast, but safe does restrict what you can do. In other words, the optimal safe solution can be slower than the optimal unsafe one.
by jfkebwjsbx 7y ago
Unsafe does not imply fast, but safe does restrict what you can do.
In other words, the optimal safe solution can be slower than the optimal unsafe one.
- wtetzner 7y agoOn the other hand, it's possible that safe code gives the compiler more guarantees, so it has more room to optimize. Whether your code is safe or unsafe can have a performance impact, but what the impact is depends on the specific situation.