cpp_weekly icon indicating copy to clipboard operation
cpp_weekly copied to clipboard

RVO and trivial types

Open lefticus opened this issue 1 year ago • 2 comments

It's not possible to observe this, but we can see the resulting code and measure it, so let's do that.

lefticus avatar Jul 12 '24 19:07 lefticus

https://quick-bench.com/q/T_oEovXBmsW5MJGvJa5sIJn3WVI

Note that clang applies RVO in both branches, in all cases. This is a missed "optimization" by GCC. But declaring them both at the top of the function would break clang too, because it cannot apply RVO to both (right? I should try that)

https://quick-bench.com/q/dQ2JY98sZlklSUYX6HamT8gVxH4

lefticus avatar Aug 09 '24 02:08 lefticus

https://compiler-explorer.com/z/dr1TdhM1M

lefticus avatar Aug 09 '24 02:08 lefticus

Coming in 456

lefticus avatar Oct 30 '24 17:10 lefticus