[libcxx-commits] [PATCH] D128146: [libc++] Use uninitialized algorithms for vector

Vitaly Buka via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 3 22:47:55 PDT 2022


vitalybuka added a comment.

If I run the following with -O2 -fno-inline, after the patch is ~50% slower
It's even worse with Asan, Msan Tsan (no -fno-inline is needed), New code calls memcpy for each P, which is intercepted.

Somehow if compiled without fno-inline and no sanitizers, performance is unaffected

Is this expected?

  #include <vector>
  
  using NodeIndex = size_t;
  class N {
   public:
    N(NodeIndex n) : v(n) {}
  
   private:
    struct P {
      size_t a;
      size_t b;
      size_t c;
    };
    std::vector<P> v;
  };
  
  int main() {
    for (int i = 0; i < 1000; ++i) {
      N b(i*10);
      std::vector<N> v(i * 2, b);
    }
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128146



More information about the libcxx-commits mailing list