I'm in the middle of watching Chandler Carruth's CppCon talk "There Are No Zero-Cost Abstractions" and there's this interesting insight: https://youtu.be/rHIkrotSwcc?t=1041
The spoiler is already in the title (sorry!), which is that passing std::unique_ptr by value is more expensive than passing it by rvalue reference, even with no exceptions! I wrote the same example using our own mozilla::UniquePtr, and got the same result: https://godbolt.org/z/-FVMcV (by-value on the left, by-rref on the right.) So I certainly need to recalibrate my gutfeelometer. A quick&dirty searchfox shows a few hundred by-value unique pointer's, we may want to look into these. Though I guess it's a trade-off between the expressiveness of by-value ("I'm stealing your value for sure") vs the more efficient but less obvious by-rref ("Maybe I'll take your value"). And there may be other types we should examine as well? Cheers, Gerald _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform