[libcxx-commits] [libcxx] [libc++][ranges] Optimize the performance of `ranges::starts_with` (PR #84570)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 27 08:55:55 PDT 2025
philnik777 wrote:
@ldionne I'm really not sure what to do. It's nice to piggy-back off of the `memcmp` optimizations the compiler can do, which means that we probably cannot compete with some implementations (the compiler can assume more about `memcmp` than it would about our implementation). OTOH we're doing better with our `mismatch` implementation than the system libc in some situations without the optimization barriers that would be required to match `memcmp` on all platforms. From a pure perofrmance stand-point, introducing our own `__memcmp` to be used everywhere instead of the libc one would probably be best. We could replace that with our own implementation if we want (though I fear people will piggy-back off of that for embedded platforms). I'm not sure how the maintainability of that would be though. Would we also introduce our own `memmove` if we can make a faster one?
https://github.com/llvm/llvm-project/pull/84570
More information about the libcxx-commits
mailing list