[Bug 223532] GNU egrep -i is terrible slow if utf-8 locale is enabled

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 02 Jun 2021 18:20:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223532

Stefan Eßer <se@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |se@FreeBSD.org

--- Comment #4 from Stefan Eßer <se@FreeBSD.org> ---
Created attachment 225506
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=225506&action=edit
Build with WITH_INTERNAL_NOSPEC for better performance

Building with -DWITH_INTERNAL_NOSPEC makes "fgrep -i" use the internal
implementation of the comparison function instead of regcomp() from the C
library.

The performance impact of using -i with or without UTF-8 is only a factor of
about 3 instead of 100:

$ LANG=C time fgrep zpipe /usr/ports/INDEX-14 
        0.03 real         0.03 user         0.00 sys

$ LANG=en_US.UTF-8 time fgrep zpipe /usr/ports/INDEX-14
        0.03 real         0.03 user         0.00 sys

$ LANG=en_US.UTF-8 time fgrep -i zpipe /usr/ports/INDEX-14 
        0.10 real         0.09 user         0.00 sys

$ LANG=en_US.UTF-8 time fgrep-ORIG -i zpipe /usr/ports/INDEX-14 
        4.47 real         4.47 user         0.00 sys

(fgrep has been built with WITH_INTERNAL_NOSPEC, while fgrep-FBSD is a copy of
the original FreeBSD fgrep built without that option.)

Both the original version and the modified version fail the same 4 kyua tests,
BTW.

-- 
You are receiving this mail because:
You are the assignee for the bug.