Hacker Newsnew | past | comments | ask | show | jobs | submit | kiwec's commentslogin

For some reason, wc is even slower with LANG=C.

    cat words.txt | time wc -w
    13018291
    0.76 user 0.01 system 0:00.78 elapsed
That's on the default wc build of void linux, and not in a proper benchmark environment, but that's still strange.


I prefer setting LC_ALL=C for to be sure, though LANG may be sufficient, as running "LANG=C locale" confirms LC_CTYPE=C is set.


After editing my code to use EOF == 0, I get :

    19.55 user 21.49 system 0:41.13 elapsed
However, you're using 8-bit cells, so the resulting word count is incorrect. In case you're wondering, the file was generated with :

    python3 -m faker -o words.txt text -r [large number] -s '\n'


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: