Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jun 2021 18:20:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 223532] GNU egrep -i is terrible slow if utf-8 locale is enabled
Message-ID:  <bug-223532-227-w1cI9TtIFK@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-223532-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

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.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-223532-227-w1cI9TtIFK>