Jan Schaumann on Nostr: Holy shit grep is slow. zcat file.xz | time perl -ne 'print if / none /' | wc -l ...
Holy shit grep is slow.
zcat file.xz | time perl -ne 'print if / none /' | wc -l
74368
0.09s real 0.04s user 0.01s system
zcat file.xz | time sed -n -e '/ none /p' | wc -l
74368
0.13s real 0.08s user 0.00s system
zcat file.xz | time awk '/ none / { print }' | wc -l
74368
0.10s real 0.05s user 0.01s system
zcat file.xz | time grep ' none ' | wc -l
74368
57.98s real 22.68s user 0.01s system
zcat file.xz | time perl -ne 'print if / none /' | wc -l
74368
0.09s real 0.04s user 0.01s system
zcat file.xz | time sed -n -e '/ none /p' | wc -l
74368
0.13s real 0.08s user 0.00s system
zcat file.xz | time awk '/ none / { print }' | wc -l
74368
0.10s real 0.05s user 0.01s system
zcat file.xz | time grep ' none ' | wc -l
74368
57.98s real 22.68s user 0.01s system