[libcxx-commits] [libcxx] [libc++] Disable the wmemchr optimization in std::find on Apple platforms (PR #217655)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 22 01:36:28 PDT 2026


================
@@ -126,7 +126,9 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T
       return __ret;
     return __last;
   }
-#  if _LIBCPP_HAS_WIDE_CHARACTERS
+  // wmemchr is very slow on apple platforms - we can do significantly better on our own.
+  // TODO: Remove this special-case once Apple's wmemchr is fixed.
+#  if _LIBCPP_HAS_WIDE_CHARACTERS && !defined(__APPLE__)
----------------
philnik777 wrote:

Glibc has a fast implementation of `wmemchr`. That's the reason we introduced this in the first place.

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


More information about the libcxx-commits mailing list