2 ms·
> The safety actually does cost some performance. I thought the safety was compile time optimization and semantic analysis, to enable code generated to feature
by jjtheblunt 4y ago
> The safety actually does cost some performance.
I thought the safety was compile time optimization and semantic analysis, to enable code generated to feature performance optimization that reflects in improved performance at runtime.
So, where are you seeing performance penalties?
- pclmulqdq 4y agoI am not enough of a Rust compiler expert to tell you exactly where the slowdowns show up, but the common theme has been that a benchmark of a small section of the critical path shows equal performance (sometimes a little faster, sometimes a little slower), and then when you expand to a larger scope, benchmarks start to slow down in comparison to their C++ alternatives. My intuitive guesses would be that the culprit is actually either larger code size, worse code layout, being unable to optimize certain code sections to the same level (undefined behavior in C++ is actually helpful for speed, and not all of it is actually unsafe), something about how calling conventions or struct layouts differ, or another "second-order" effect.
- jjtheblunt 4y agothat's interesting ... thank you