[libcxx-commits] [PATCH] D67524: P1144 "Trivially relocatable" (3/3): optimize std::vector and std::swap for trivially relocatable types
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 18 20:55:04 PDT 2019
Quuxplusone updated this revision to Diff 220798.
Quuxplusone added a comment.
Add a new benchmark, and add a `TriviallyRelocatableType` to the matrix in `algorithms.bench.cpp`.
My expectation is that `swap.bench.cpp` should get noticeably faster after this patch.
My less confident expectation is that the new `.*trivre.*` test cases in `algorithms.bench.cpp` should initially be noticeably worse than the `.*string.*` cases, but after this patch they should catch up. What's happening there is that when you swap strings, you're calling string's own ADL overload of `swap` which is very fast, but when you swap `TriviallyRelocatableType`s, you're calling the generic `std::swap<TriviallyRelocatableType>` which is not quite so fast until this patch makes it do memcpy.
I'm putting the benchmarks right here in this patch so that @ericwf can run them. (Zoe and I produced some good-looking benchmark numbers earlier tonight, with code similar to this code; but my build tree is too screwed up to reproduce them on demand.)
CHANGES SINCE LAST ACTION
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 17700 bytes
Desc: not available
More information about the libcxx-commits