https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101923
Bug ID: 101923
Summary: std::function's move ctor is slower than the copy one
for empty source objects
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101923
--- Comment #1 from Petar Ivanov ---
Benchmark code (using Google Benchmark):
#include
#include
#include
struct Car {};
static void copy(benchmark::State& state) {
for (auto _ : state) {
const auto f = std::function{};
const aut
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101923
--- Comment #3 from Petar Ivanov ---
Thank you for pointing the output on x86!
Following that, I checked O2 and O3 on ARM64 and I see differences, though I
cannot say what their actual impact is:
02: https://godbolt.org/z/P9Garznef
O3: https:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101923
--- Comment #5 from Petar Ivanov ---
(In reply to Andrew Pinski from comment #4)
> Hmm
>
> __tmp = MEM[(union _Any_data & {ref-all})&f];
> MEM[(union _Any_data * {ref-all})&f] = MEM[(union _Any_data &
> {ref-all})&moved];
> MEM[(union _An
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101923
Petar Ivanov changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---