Fields

hardware None
os None

Parameters

Fields

NameValue

Parameters

NameValue
git_commit commit e4eccd6a3c2415c10bb8217c247d7aca76cc9ad5
Author: Nikolas Klauser <nikolasklauser@berlin.de>
Date: Mon Aug 25 21:45:20 2025 +0200

[libc++] Optimize __hash_table::erase(iterator, iterator) (#152471)

Instead of just calling the single element `erase` on every element of
the range, we can combine some of the operations in a custom
implementation. Specifically, we don't need to search for the previous
node or re-link the list every iteration. Removing this unnecessary work
results in some nice performance improvements:
```
-----------------------------------------------------------------------------------------------------------------------
Benchmark old new
-----------------------------------------------------------------------------------------------------------------------
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/0 457 ns 459 ns
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/32 995 ns 626 ns
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/1024 18196 ns 7995 ns
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/8192 124722 ns 70125 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/0 456 ns 461 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/32 1183 ns 769 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/1024 27827 ns 18614 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/8192 266681 ns 226107 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/0 455 ns 462 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/32 996 ns 659 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/1024 15963 ns 8108 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/8192 136493 ns 71848 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/0 454 ns 455 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/32 985 ns 703 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/1024 16277 ns 9085 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/8192 125736 ns 82710 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/0 457 ns 454 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/32 1091 ns 646 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/1024 17784 ns 7664 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/8192 127098 ns 72806 ns
```
Filter

ldionne-old-macbook-results test results

Run Order Start Time Duration
Current 549923 2025-12-16T16:40:01 0:00:00
Previous 549739 2025-12-16T16:40:01 0:00:00
Baseline 485288 2025-12-16T16:40:01 0:00:00


Tests Summary

Status Group # # (B)
Performance Regressions 6 0
Performance Improvements 2 0
Added Tests 0 16
Unchanged Tests 72 64
Total Tests 80

Performance Regressions - execution_time Δ Previous Current σ Δ (B) σ (B)
734_vpr_r 2.13% 15.153 15.476 - 0.00% -
737_gmsh_r 1.98% 12.962 13.219 - 0.00% -
723_llvm_r 1.64% 11.597 11.788 - 0.00% -
729_abc_r 1.58% 18.776 19.073 - 0.00% -
731_astcenc_r 1.54% 10.139 10.296 - 0.00% -
727_cppcheck_r 1.25% 24.439 24.745 - 0.00% -

Performance Improvements - execution_time Δ Previous Current σ Δ (B) σ (B)
707_ntest_r -2.88% 18.660 18.123 - 0.00% -
753_ns3_r -1.11% 10.683 10.564 - 0.00% -

Added Tests - execution_time
706_stockfish_r
707_ntest_r
709_cactus_r
710_omnetpp_r
721_gcc_r
723_llvm_r
727_cppcheck_r
729_abc_r
731_astcenc_r
734_vpr_r
736_ocio_r
737_gmsh_r
748_flightdm_r
750_sealcrypto_r
753_ns3_r
766_femflow_r


Report Time: 0.12s
Name Current %
706_stockfish_r 22.271 -
707_ntest_r 18.123 -2.88%
709_cactus_r 19.860 -
710_omnetpp_r 8.405 -
721_gcc_r 13.149 -
723_llvm_r 11.788 1.64%
727_cppcheck_r 24.745 1.25%
729_abc_r 19.073 1.58%
731_astcenc_r 10.296 1.54%
734_vpr_r 15.476 2.13%
736_ocio_r 16.336 -
737_gmsh_r 13.219 1.98%
748_flightdm_r 8.872 -
750_sealcrypto_r 18.627 -
753_ns3_r 10.564 -1.11%
766_femflow_r 12.939 -
Geometric Mean 14.503 -