bug-gnu-utils
[Top][All Lists]
Advanced

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

LC_CTYPE=C speeds 'grep a' 800 times


From: Dan Jacobson
Subject: LC_CTYPE=C speeds 'grep a' 800 times
Date: Sat, 16 Aug 2003 03:04:54 +0800
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Gentlemen, what's the deal in that the shorter the regexp, the longer
the grep time?
# time zcat /var/log/syslog.*.gz|grep . > /dev/null
real    0m28.991s
user    0m28.990s
sys     0m0.000s
# time zcat /var/log/syslog.*.gz|grep fetchmail > /dev/null
real    0m6.556s
user    0m6.550s
sys     0m0.000s
# time zcat /var/log/syslog.*.gz|grep a > /dev/null
real    0m28.200s
user    0m28.190s
sys     0m0.010s
# grep --version
grep (GNU grep) 2.5.1

Holy s*it batman, it was all a plot by the elite westerners to slow
down other races' computers!

# time zcat /var/log/syslog.*.gz|LC_CTYPE=C grep . > /dev/null
real    0m0.035s
user    0m0.030s
sys     0m0.000s
# time zcat /var/log/syslog.*.gz|LC_CTYPE=C grep fetchmail > /dev/null
real    0m0.030s
user    0m0.030s
sys     0m0.000s
# time zcat /var/log/syslog.*.gz|LC_CTYPE=C grep a > /dev/null
real    0m0.035s
user    0m0.020s
sys     0m0.020s

Normally I have
LANG=zh_TW.Big5
LC_CTYPE=zh_TW.Big5

Anyway, fgrep only helped in the "." case, 16 sec vs. 28.

Anyway, 800 times!




reply via email to

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