fnmatch has exponential running time
James Youngman
jay@gnu.org
Fri Mar 23 09:28:00 GMT 2007
On 3/22/07, Bruno Haible <bruno@clisp.org> wrote:
> fnmatch() has a worst-case complexity O(m*n) where m is the size of the
> pattern and n is the size of the sample string. Unfortunately glibc has
> chosen an implementation with exponential running time.
Yes. Oddly, per some testng I did about a year ago, "find -regex" is
much faster than "find -name". The former uses the Gnulib regex
support and the latter uses fnmatch().
James.
More information about the Libc-alpha
mailing list