[all-commits] [llvm/llvm-project] fdd089: [libc++] Implement ranges::contains (#65148)

ZijunZhaoCCK via All-commits all-commits at lists.llvm.org
Tue Dec 19 16:34:32 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fdd089b500631b123bc70d04dd016b41f9323f4c
      https://github.com/llvm/llvm-project/commit/fdd089b500631b123bc70d04dd016b41f9323f4c
  Author: ZijunZhaoCCK <88353225+ZijunZhaoCCK at users.noreply.github.com>
  Date:   2023-12-19 (Tue, 19 Dec 2023)

  Changed paths:
    M libcxx/benchmarks/CMakeLists.txt
    A libcxx/benchmarks/algorithms/ranges_contains.bench.cpp
    M libcxx/include/CMakeLists.txt
    A libcxx/include/__algorithm/ranges_contains.h
    M libcxx/include/__functional/identity.h
    M libcxx/include/algorithm
    M libcxx/include/module.modulemap.in
    M libcxx/modules/std/algorithm.inc
    M libcxx/test/libcxx/algorithms/ranges_robust_against_copying_projections.pass.cpp
    M libcxx/test/libcxx/diagnostics/nodiscard_extensions.compile.pass.cpp
    M libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp
    A libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp
    M libcxx/test/std/algorithms/ranges_robust_against_omitting_invoke.pass.cpp
    M libcxx/test/std/algorithms/ranges_robust_against_proxy_iterators.pass.cpp
    M libcxx/test/std/library/description/conventions/customization.point.object/niebloid.compile.pass.cpp

  Log Message:
  -----------
  [libc++] Implement ranges::contains (#65148)

Differential Revision: https://reviews.llvm.org/D159232
```
Running ./ranges_contains.libcxx.out
Run on (10 X 24.121 MHz CPU s)
CPU Caches:
  L1 Data 64 KiB (x10)
  L1 Instruction 128 KiB (x10)
  L2 Unified 4096 KiB (x5)
Load Average: 3.37, 6.77, 5.27
--------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations
--------------------------------------------------------------------
bm_contains_char/16             1.88 ns         1.87 ns    371607095
bm_contains_char/256            7.48 ns         7.47 ns     93292285
bm_contains_char/4096           99.7 ns         99.6 ns      7013185
bm_contains_char/65536          1296 ns         1294 ns       540436
bm_contains_char/1048576       23887 ns        23860 ns        29302
bm_contains_char/16777216     389420 ns       389095 ns         1796
bm_contains_int/16              7.14 ns         7.14 ns     97776288
bm_contains_int/256             90.4 ns         90.3 ns      7558089
bm_contains_int/4096            1294 ns         1290 ns       543052
bm_contains_int/65536          20482 ns        20443 ns        34334
bm_contains_int/1048576       328817 ns       327965 ns         2147
bm_contains_int/16777216     5246279 ns      5239361 ns          133
bm_contains_bool/16             2.19 ns         2.19 ns    322565780
bm_contains_bool/256            3.42 ns         3.41 ns    205025467
bm_contains_bool/4096           22.1 ns         22.1 ns     31780479
bm_contains_bool/65536           333 ns          332 ns      2106606
bm_contains_bool/1048576        5126 ns         5119 ns       135901
bm_contains_bool/16777216      81656 ns        81574 ns         8569
```

---------

Co-authored-by: Nathan Gauër <brioche at google.com>




More information about the All-commits mailing list