[Bug libstdc++/80335] perf of copying std::optional
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80335 --- Comment #3 from sgunderson at bigfoot dot com --- Appears to have been fixed in GCC 8, indeed. #include std::optional func() { return 3; } GCC 7 (-O2) compiles to: 0: 48 89 f8mov%rdi,%rax 3: c7 07 03 00 00 00 movl $0x3,(%rdi) 9: c6 47 04 01 movb $0x1,0x4(%rdi) d: c3 retq GCC 8 (-O2): 0: 48 b8 03 00 00 00 01movabs $0x10003,%rax 7: 00 00 00 a: c3 retq This is an ABI break, but I'll happily take it. :-)
[Bug libstdc++/80335] perf of copying std::optional
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80335 Marc Glisse changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Marc Glisse --- Looks like this is fixed. Although the limitations discussed are present: optional> copies the whole array even if it is never engaged.
[Bug libstdc++/80335] perf of copying std::optional
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80335 sgunderson at bigfoot dot com changed: What|Removed |Added CC||sgunderson at bigfoot dot com --- Comment #1 from sgunderson at bigfoot dot com --- This also affects the _returning_ std::optional; since it is not trivially copy constructible, std::optional must be returned (at least on amd64) by means of a hidden parameter instead of in registers. Since this affects the return type ABI, it can't be changed easily after-the-fact, so if possible, it should be fixed before C++17 support becomes non-experimental.
[Bug libstdc++/80335] perf of copying std::optional
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80335 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2017-04-06 Ever confirmed|0 |1