[PATCH] D22470: [libcxx] Improve shared_ptr dtor performance

Ben Craig via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 18 11:31:10 PDT 2016


bcraig created this revision.
bcraig added reviewers: jfb, mclow.lists, EricWF.
bcraig added a subscriber: cfe-commits.

If the last destruction is uncontended, skip the atomic store on
__shared_weak_owners_.

For x86_64, this results in an 8% improvement in shared_ptr ctor+dtor
performance.
Old benchmarks/shared_ptr_create_destroy.cpp: 26.8638 seconds
New benchmarks/shared_ptr_create_destroy.cpp: 24.6019 seconds

The increment / decrement code path did not degrade on X86_64.
Old benchmarks/shared_ptr_inc_dec_ref.cpp: 13.0896 seconds
New benchmarks/shared_ptr_inc_dec_ref.cpp: 13.0463 seconds


https://reviews.llvm.org/D22470

Files:
  benchmarks/shared_ptr_create_destroy.cpp
  benchmarks/shared_ptr_inc_dec_ref.cpp
  src/memory.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22470.64357.patch
Type: text/x-patch
Size: 4303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160718/9a967928/attachment-0001.bin>


More information about the cfe-commits mailing list