Last active
December 18, 2015 17:19
-
-
Save cam8001/5817883 to your computer and use it in GitHub Desktop.
Speed difference between GNU grep and OSX 10.8 BSD grep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ grep --version | |
grep (BSD grep) 2.5.1-FreeBSD | |
$ ggrep --version | |
ggrep (GNU grep) 2.14 | |
# Here it goes | |
$ time cat varnish_log_200_only.txt | ggrep -F 'www.some.url.gov' | wc -l | |
957979 | |
real 0m27.424s | |
user 0m27.428s | |
sys 0m1.481s | |
$ time cat varnish_log_200_only.txt | grep -F 'www.some.url.gov' | wc -l | |
957979 | |
real 0m58.179s | |
user 0m58.168s | |
sys 0m1.845s |
Mavericks' grep version is unchanged from Mountain Lion:
$ uname -a && grep -V
Darwin kerbcrawler 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
grep (BSD grep) 2.5.1-FreeBSD
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, gnu grep seems to cache results in some way or another, whereas bsd grep doesn't. Apparently this is happening at the filesystem level rather than in grep itself, but it doesn't seem to cache under bsd grep.