3 ms·
And those optimizations apply regardless of whether the function checks the parameter internally and panics on failure, or if you check the parameter before cal
by Arnavion 4y ago
And those optimizations apply regardless of whether the function checks the parameter internally and panics on failure, or if you check the parameter before calling the function and unwrap the function result. Again, there is no difference. There's really no need to argue about this. Feel free to godbolt it.
- junon 4y agoYou're right. https://godbolt.org/z/cfr8MEG6j https://godbolt.org/z/cfr8MEG6j https://godbolt.org/z/7crr4n66Y https://godbolt.org/z/7crr4n66Y I suppose I'm used to C/C++ compilers not going as far down the optimization rabbit hole as Rust seems to, where they often miss more complex optimizations like this in sufficiently advanced wrapper types etc.