4 ms·
Basically, the grandparent poster was inferring "CXX is not worth using because its not perfectly zero-cost". Like with any premature optimization, I was just
by yazaddaruvala 6y ago
Basically, the grandparent poster was inferring "CXX is not worth using because its not perfectly zero-cost".
Like with any premature optimization, I was just pointing out that perfectly zero-cost is not always the goal i.e. if it is short lived code, don't worry about the inefficiency in the FFI.
If the FFI code is going to be long lived, and the team has followed all of the rules for optimization (i.e. measure, profile, etc) and CXX cannot support the performance they need, then in this very unique situation CXX might not be the right tool for the job. Instead it can sometimes be a good decision to write custom unsafe code, abstract it, validate it, write tests for it, basically spend X weeks of dev effort on making the custom unsafe code "safe" with the knowledge that it's an investment for the long term.