[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26193: [0-9] versus [[:digit:]]

From: Paul Eggert
Subject: bug#26193: [0-9] versus [[:digit:]]
Date: Tue, 21 Mar 2017 19:09:41 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

John P. Linderman wrote:
Using what is to me the more obvious [0-9] pattern takes almost 50 times as
long as using the [[:digit:]] pattern. Seems very strange.

Thanks for reporting that. In general, patterns like [a-z] can be much slower than [[:lower:]] due to poorly-thought-out POSIX interfaces. However, [0-9] is a special case: we can optimize such patterns safely if both ends are ASCII digits. I installed the attached patch to Gnulib to do that; it fixes the performance glitch you noticed, at least for me.

Attachment: 0001-dfa-make-0-9-faster-in-non-C-locales.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]