[libcxx-commits] [PATCH] D80588: Optimize vector push_back to avoid continuous load and store of end pointer.

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 29 08:07:01 PDT 2020


EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

@mvels Do we have macro-benchmark results for this change?



================
Comment at: libcxx/include/vector:949
+                                                    _Args&&... __args) {
+    _AsanTransaction tx(*this, 1);
+    __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__pos),
----------------
If this is the only place `_AsanTransaction` is used, does it need to be this complicated?


================
Comment at: libcxx/include/vector:1724
 {
-    if (this->__end_ < this->__end_cap())
+    pointer __end = this->__end_;
+    if (__end < this->__end_cap())
----------------
Could we rename `__end` here, because it only sometimes stores the end iterator. Maybe `__last` or `__back`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80588/new/

https://reviews.llvm.org/D80588





More information about the libcxx-commits mailing list