[all-commits] [llvm/llvm-project] c81bfc: [libc++] Optimize for_each for segmented iterators

philnik777 via All-commits all-commits at lists.llvm.org
Tue Nov 14 14:55:55 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c81bfc61da7e3a17a0ecd42ad049c9cd74384192
      https://github.com/llvm/llvm-project/commit/c81bfc61da7e3a17a0ecd42ad049c9cd74384192
  Author: Nikolas Klauser <nikolasklauser at berlin.de>
  Date:   2023-11-14 (Tue, 14 Nov 2023)

  Changed paths:
    M libcxx/benchmarks/CMakeLists.txt
    A libcxx/benchmarks/algorithms/for_each.bench.cpp
    M libcxx/docs/ReleaseNotes/18.rst
    M libcxx/include/__algorithm/for_each.h
    A libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.pass.cpp
    R libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp
    M libcxx/utils/data/ignore_format.txt

  Log Message:
  -----------
  [libc++] Optimize for_each for segmented iterators

```
---------------------------------------------------
Benchmark                       old             new
---------------------------------------------------
bm_for_each/1               3.00 ns         2.98 ns
bm_for_each/2               4.53 ns         4.57 ns
bm_for_each/3               5.82 ns         5.82 ns
bm_for_each/4               6.94 ns         6.91 ns
bm_for_each/5               7.55 ns         7.75 ns
bm_for_each/6               7.06 ns         7.45 ns
bm_for_each/7               6.69 ns         7.14 ns
bm_for_each/8               6.86 ns         4.06 ns
bm_for_each/16              11.5 ns         5.73 ns
bm_for_each/64              43.7 ns         4.06 ns
bm_for_each/512              356 ns         7.98 ns
bm_for_each/4096            2787 ns         53.6 ns
bm_for_each/32768          20836 ns          438 ns
bm_for_each/262144        195362 ns         4945 ns
bm_for_each/1048576       685482 ns        19822 ns
```

Reviewed By: ldionne, Mordante, #libc

Spies: bgraur, sberg, arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D151274




More information about the All-commits mailing list