* Michael G Schwern <schw...@pobox.com> [2007-11-19 10:25]: > A. Pagaltzis wrote: > > Reminds me, this is not the only GNU tool that needs such > > treatment. GNU grep pays attention to the locale as well, but > > its encoding decoder is apparently written in Visual Basic -- > > if you use a UTF-8 locale, it will slow down by TWO ORDERS OF > > MAGNITUDE. > > > > $ time LC_CTYPE=en_US.utf8 grep -cq tes /usr/share/dict/words > > > > real 0m0.686s > > user 0m0.680s > > sys 0m0.004s > > > > $ time LC_CTYPE=C grep -cq tes /usr/share/dict/words > > > > real 0m0.006s > > user 0m0.004s > > sys 0m0.000s > > Are you sure you didn't just measure disk caching? I don't any > different results between the two on OS X.
Those measurements were with hot cache and are reliably reproducible on my machine. Possibly you need to set more locale variables; I also have LANG set. (The "funny" thing is I had LC_COLLATE set to `C` already, so grep should not be doing any decoding *anyway*.) Or your GNU utils have been compiled with other switches. Or something. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>