[libcxx-commits] [libcxx] [libc++] Tiny optimizations for is_permutation (PR #129565)
Imad Aldij via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 20 07:52:46 PDT 2025
imdj wrote:
> Indeed, this is the speedup I get when I drop `std::ref` from the `mismatch` call and ensure that we vectorize on AppleClang
I'm missing some piece of the puzzle. I couldn't reach those numbers. Like mentioned above in the benchmarks , I'm currently getting:
```
OVERALL_GEOMEAN -0.0022 -0.0022 0 0 0 0
```
Just dropping `std::ref()` like such `auto __result = std::mismatch(__first1, __last1, __first2, __pred);` will lead to copies/failed tests and even then, the performance still took a hit:
```
OVERALL_GEOMEAN -0.0013 -0.0013 0 0 0 0
```
I also tried using `std::__mismatch` directly to avoid making copies something like this:
```cpp
__identity __ident;
auto __result = std::__mismatch(__first1, __last1, __first2, __pred, __ident, __ident);
```
but that also ended up with worse results
```
OVERALL_GEOMEAN -0.0009 -0.0009 0 0 0 0
```
What am I doing wrong :(
https://github.com/llvm/llvm-project/pull/129565
More information about the libcxx-commits
mailing list