[libcxx-commits] [PATCH] D119385: Use trivial relocation operations in std::vector, by porting D67524 and part of D61761 to work on top of the changes in D114732.
Devin Jeanpierre via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 17 12:29:33 PST 2022
devin.jeanpierre updated this revision to Diff 409751.
devin.jeanpierre added a comment.
Add benchmark. Unfortunately, I've failed to actually run it against clang -- I don't know how to run benchmarks against the (unreleased) version of clang that's in the current git repo, so all I've done is run it locally (against gcc, I think).
I have a superset of this benchmark I ran at work (using the internal version of benchmark), shows a 40% performance improvement for trivially relocatable types when using the current version of clang. For example (using unique_ptr with trivial_abi <https://libcxx.llvm.org//DesignDocs/UniquePtrTrivialAbi.html>):
name old cpu/op new cpu/op delta
BM_Vector_Push_Copy<int*> 4.11ns ±38% 4.11ns ±44% -0.05% (p=0.021 n=2301+2238)
BM_Vector_Push_Move<std::shared_ptr<int>> 13.3ns ±37% 9.1ns ±42% -31.71% (p=0.000 n=1678+1483)
BM_Vector_Push_Move<std::unique_ptr<int>> 7.05ns ±10% 4.36ns ± 8% -38.11% (p=0.000 n=1716+1957)
My expectation is that this benchmark I have added here would also show the same, if only I knew how to run it. :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119385/new/
https://reviews.llvm.org/D119385
Files:
libcxx/benchmarks/vector_operations.bench.cpp
libcxx/include/__memory/allocator_traits.h
libcxx/include/memory
libcxx/include/type_traits
libcxx/include/vector
libcxx/test/libcxx/containers/sequences/vector/insert_trivially_relocatable.pass.cpp
libcxx/test/libcxx/type_traits/is_trivially_relocatable.pass.cpp
libcxx/test/libcxx/utilities/meta/meta.unary.prop/is_trivially_relocatable.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_exception_safety.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119385.409751.patch
Type: text/x-patch
Size: 37668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220217/b593ce14/attachment-0001.bin>
More information about the libcxx-commits
mailing list