You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
yeah I was pretty sure that std::move/std::copy is generally implemented in terms of memmove/memcpy for trivially-copyable stuff, etc. In godbolt a simple test of std::move in a vector of pod types actually turned into a bunch of MOVUPS if the range was of constant size, or a call to memmove if it wasn't: https://godbolt.org/z/t81plU
7 commit comments
Evil-Spirit commentedon May 24, 2019
probably, performance degradation
whitequark commentedon May 24, 2019
Why?
Evil-Spirit commentedon May 24, 2019
I remember such performance issue when profiling. Evil-Spirit@44eb1a4#diff-b7a4b1c7a3c5a4ea4f00130583590ff4R336
Evil-Spirit commentedon May 24, 2019
I turn back memmove and probably get some speedup.
whitequark commentedon May 24, 2019
OK, that's good to know. Maybe we need to define our own
std::move
for POD types that will have the same interface but is faster.Though I do not know why they couldn't just specialize
std::move
itself for POD types, you can use SFINAE for it, I think...rpavlik commentedon May 24, 2019
yeah I was pretty sure that std::move/std::copy is generally implemented in terms of memmove/memcpy for trivially-copyable stuff, etc. In godbolt a simple test of std::move in a vector of pod types actually turned into a bunch of MOVUPS if the range was of constant size, or a call to memmove if it wasn't: https://godbolt.org/z/t81plU
ruevs commentedon May 25, 2019
https://cppinsights.io/lnk?code=I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPHZlY3Rvcj4KCnN0cnVjdCBCbGEgewogIGludCB4OwogIGZsb2F0IHk7CiAgZG91YmxlIHo7Cn07CgovLyBUeXBlIHlvdXIgY29kZSBoZXJlLCBvciBsb2FkIGFuIGV4YW1wbGUuCnZvaWQgdHJ5aXQoc3RkOjp2ZWN0b3I8QmxhPiAmc3R1ZmYsIHNpemVfdCBuLCBzaXplX3Qgb2Zmc2V0KSB7CiAgLy9zdGQ6OnZlY3RvcjxCbGE+IHN0dWZmKDgsIEJsYXsxLCAxLCAxfSk7CiAgc3RkOjptb3ZlKHN0dWZmLmJlZ2luKCksIHN0dWZmLmJlZ2luKCkgKyBuLCBzdHVmZi5iZWdpbigpICsgb2Zmc2V0KTsKfQ==&std=cpp2a&rev=1.0