[all-commits] [llvm/llvm-project] 8670b5: [libc++] Optimize ranges::find for vector<bool>

philnik777 via All-commits all-commits at lists.llvm.org
Tue Aug 1 10:28:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8670b53e11bb4f41eeef812472ff8efa957470a1
      https://github.com/llvm/llvm-project/commit/8670b53e11bb4f41eeef812472ff8efa957470a1
  Author: Nikolas Klauser <nikolasklauser at berlin.de>
  Date:   2023-08-01 (Tue, 01 Aug 2023)

  Changed paths:
    M libcxx/benchmarks/algorithms/find.bench.cpp
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__algorithm/find.h
    A libcxx/include/__bit/invert_if.h
    M libcxx/include/__bit_reference
    A libcxx/include/__fwd/bit_reference.h
    M libcxx/include/bitset
    M libcxx/test/libcxx/transitive_includes/cxx03.csv
    M libcxx/test/libcxx/transitive_includes/cxx11.csv
    M libcxx/test/libcxx/transitive_includes/cxx14.csv
    M libcxx/test/libcxx/transitive_includes/cxx17.csv
    M libcxx/test/libcxx/transitive_includes/cxx20.csv
    M libcxx/test/libcxx/transitive_includes/cxx23.csv
    M libcxx/test/libcxx/transitive_includes/cxx26.csv

  Log Message:
  -----------
  [libc++] Optimize ranges::find for vector<bool>

Benchmark results:
```
----------------------------------------------------------------
Benchmark                                    old             new
----------------------------------------------------------------
bm_vector_bool_ranges_find/1             5.64 ns         6.08 ns
bm_vector_bool_ranges_find/2             16.5 ns         6.03 ns
bm_vector_bool_ranges_find/3             20.3 ns         6.07 ns
bm_vector_bool_ranges_find/4             22.2 ns         6.08 ns
bm_vector_bool_ranges_find/5             23.5 ns         6.05 ns
bm_vector_bool_ranges_find/6             24.4 ns         6.10 ns
bm_vector_bool_ranges_find/7             26.7 ns         6.10 ns
bm_vector_bool_ranges_find/8             25.0 ns         6.08 ns
bm_vector_bool_ranges_find/16            27.9 ns         6.07 ns
bm_vector_bool_ranges_find/64            44.5 ns         5.35 ns
bm_vector_bool_ranges_find/512            243 ns         25.7 ns
bm_vector_bool_ranges_find/4096          1858 ns         35.6 ns
bm_vector_bool_ranges_find/32768        15461 ns         93.5 ns
bm_vector_bool_ranges_find/262144      126462 ns          571 ns
bm_vector_bool_ranges_find/1048576     497736 ns         2272 ns
```

Reviewed By: #libc, Mordante

Spies: var-const, Mordante, libcxx-commits

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




More information about the All-commits mailing list