[libcxx-commits] [PATCH] D144394: [libc++] Forward to std::{, w}memchr in std::find

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 16 09:59:36 PDT 2023


philnik added inline comments.


================
Comment at: libcxx/benchmarks/algorithms/find.bench.cpp:21
+  for (auto _ : state) {
+    auto idx  = rng() % vec1.size();
+    vec1[idx] = '2';
----------------
ldionne wrote:
> We should stop/start the timing to avoid including this bit in the benchmark, since this is calling into `mt199whatever` which is non trivial.
> 
> You can use `state.PauseTiming()` and `ResumeTiming()` to do this. You should also check whether that introduces a bunch of noise in the timings, I've noticed that before.
When adding them the times are in the hundreds of nanoseconds for single elements. Also, the documentation says:
```
  // NOTE: PauseTiming()/ResumeTiming() are relatively
  // heavyweight, and so their use should generally be avoided
  // within each benchmark iteration, if possible.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144394/new/

https://reviews.llvm.org/D144394



More information about the libcxx-commits mailing list