[libcxx-commits] [libcxx] Optimize std::__tree::__assign_multi to insert the provided range at the end of the tree every time (PR #131030)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 27 04:51:43 PDT 2025


philnik777 wrote:

@higher-performance I can't see much of a difference. These are the numbers from our benchmarks:
```
--------------------------------------------------------------------------------------------------
Benchmark                                                                         old          new
--------------------------------------------------------------------------------------------------
std::set<int>::ctor(const&)/32                                                 487 ns       492 ns
std::set<int>::ctor(const&)/1024                                             23391 ns     23758 ns
std::set<int>::ctor(const&)/8192                                            239519 ns    246201 ns
std::set<int>::ctor(iterator, iterator) (unsorted sequence)/32                 520 ns       515 ns
std::set<int>::ctor(iterator, iterator) (unsorted sequence)/1024             55183 ns     55256 ns
std::set<int>::ctor(iterator, iterator) (unsorted sequence)/8192            749516 ns    761760 ns
std::set<int>::ctor(iterator, iterator) (sorted sequence)/32                   517 ns       524 ns
std::set<int>::ctor(iterator, iterator) (sorted sequence)/1024               24800 ns     24731 ns
std::set<int>::ctor(iterator, iterator) (sorted sequence)/8192              229736 ns    241529 ns
std::set<int>::operator=(const&)/32                                            540 ns       563 ns
std::set<int>::operator=(const&)/1024                                        28827 ns     28390 ns
std::set<int>::operator=(const&)/8192                                       290951 ns    287785 ns
std::set<int>::insert(iterator, iterator) (all new keys)/32                   1148 ns      1129 ns
std::set<int>::insert(iterator, iterator) (all new keys)/1024                30299 ns     29754 ns
std::set<int>::insert(iterator, iterator) (all new keys)/8192               334470 ns    331822 ns
std::set<int>::insert(iterator, iterator) (half new keys)/32                   865 ns       864 ns
std::set<int>::insert(iterator, iterator) (half new keys)/1024               32034 ns     32017 ns
std::set<int>::insert(iterator, iterator) (half new keys)/8192              396411 ns    389757 ns
```

https://github.com/llvm/llvm-project/pull/131030


More information about the libcxx-commits mailing list