3 ms·
Perhaps not a fair comparison until you account for the C library's string comparison behaviors. If your default is LANG=C.UTF-8, your wc may be a bunch slower
by imglorp 7y ago
Perhaps not a fair comparison until you account for the C library's string comparison behaviors. If your default is LANG=C.UTF-8, your wc may be a bunch slower than LANG=C. I think OSX is still using gnu wc, yes? Maybe the Dialog race should be repeated with this controlled for.
https://old.reddit.com/r/programming/comments/1sxpgp/make_grep_50x_faster/ https://old.reddit.com/r/programming/comments/1sxpgp/make_gr...
Edit. Still true in Linux today.
$ LANG=C time -p wc /tmp/foo 2>&1 >/dev/null
real 0.29
user 0.28
sys 0.01
$ LANG=C.UTF-8 time -p wc /tmp/foo 2>&1 >/dev/null
real 0.86
user 0.86
sys 0.00
- saagarjha 7y agoIt’s a FreeBSD derivative: https://opensource.apple.com/source/text_cmds/text_cmds-99/wc/wc.c.auto.html https://opensource.apple.com/source/text_cmds/text_cmds-99/w...
- imglorp 7y agoLooks like they have the same problem. They're using LC_CTYPE to hint mbrtowc(). In fact, if you web search "mbrtowc slow" you'll get a bunch of hits about "Why is wc so slow"!! :-)