[libcxx-commits] [libcxx] [libc++] Fold __search_substring into _Traits::find in case the second string has length 1 (PR #160076)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 15 07:25:07 PDT 2025


bgra8 wrote:

@philnik777 we (at google) have bisected a performance regression caused by this change in the https://github.com/abseil/abseil-cpp/blob/master/absl/strings/string_view_benchmark.cc which benchmarks the standard `std::string_view` class.

Interestingly we only see the regressions on ARM servers:

| Benchmark  |               Baseline (ns) |        This revision  (ns)    | Diff (ns) | Regression |
|-------------|------------------|---------------------|-----|------------|
| BM_find_string_view_len_one/1 | 5.17 |  9.88  |  4.71 |  91% |
| BM_find_string_view_len_one/8 | 5.17 |  9.88 |  4.71 | 91% |

The regression is computed as: `(exp - base) / base * 100`

I don't have an Apple M4 (which is also ARM) readily available to check if the regression reproduces there. Would it be possible for you to check or maybe replicate the `std::string_view` benchmark? Maybe it would make sense for `std::string_view` to have a dedicated benchmark the same way as `std::string` already has?


https://github.com/llvm/llvm-project/pull/160076


More information about the libcxx-commits mailing list