]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
mcel: remove forced use of GLIBC's mbrtoc32
authorPádraig Brady <P@draigBrady.com>
Sun, 5 Apr 2026 11:30:21 +0000 (12:30 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 5 Apr 2026 11:42:33 +0000 (12:42 +0100)
This is a performance win on GLIBC,
as tested on the coreutils multi-byte update to cut(1):

   $ yes $(yes éééááé | head -n9 | paste -s -d,) |
     head -n1M > mb.in

   $ time LC_ALL=C.UTF-8 src/cut-before -c1 mb.in >/dev/null
   real    0m1.582s

   $ time LC_ALL=C.UTF-8 src/cut-after -c1 mb.in >/dev/null
   real    0m0.592s

* lib/mcel.h: While GLIBC's mbrtoc32 is functional for mcel,
it is seen to be 2.6x slower than gnulib's implementation
due to GLIBC's per call locale handling.

ChangeLog
lib/mcel.h

index 55cf2efc348c541bccca1398af7c5270dde3c848..9586cedb015de2f7e8c4e2daa604e87983fb23ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-04-05  Pádraig Brady  <P@draigBrady.com>
+
+       mcel: remove forced use of GLIBC's mbrtoc32
+       * lib/mcel.h: While GLIBC's mbrtoc32 is functional for mcel,
+       it is seen to be 2.6x slower than gnulib's implementation
+       due to GLIBC's per call locale handling.
+
 2026-04-04  Bruno Haible  <bruno@clisp.org>
 
        posix_spawn-internal: Remove a FIXME.
index 757a97593f0a52302e353da2e74e80fa7a4b9e6d..5eedd5b610004d2942d06d1007c53d6263861245 100644 (file)
@@ -217,13 +217,6 @@ mcel_isbasic (char c)
   return _GL_LIKELY (0 <= c && c < MCEL_ERR_MIN);
 }
 
-/* With mcel there should be no need for the performance overhead of
-   replacing glibc mbrtoc32, as callers shouldn't care whether the
-   C locale treats a byte with the high bit set as an encoding error.  */
-#ifdef __GLIBC__
-# undef mbrtoc32
-#endif
-
 /* Scan bytes from P inclusive to LIM exclusive.  P must be less than LIM.
    Return the character or encoding error starting at P.  */
 MCEL_INLINE mcel_t