Skip to content

Instantly share code, notes, and snippets.

@BurntSushi
Created November 13, 2018 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BurntSushi/1203d5b56112a8c1bacff5b19273d956 to your computer and use it in GitHub Desktop.
Save BurntSushi/1203d5b56112a8c1bacff5b19273d956 to your computer and use it in GitHub Desktop.
----- CAT
real 0m0.070s
user 0m0.007s
sys 0m0.063s
----- WC
12032690 _tmp/all-10.txt
real 0m0.213s
user 0m0.156s
sys 0m0.057s
----- FGREP
real 0m0.027s
user 0m0.023s
sys 0m0.003s
----- GREP
real 0m0.021s
user 0m0.015s
sys 0m0.006s
----- RIPGREP
real 0m0.820s
user 0m0.788s
sys 0m0.031s
0
----- read:count-lines
num_lines = 0
num_bytes = 353423380
real 0m0.118s
user 0m0.077s
sys 0m0.041s
----- read:re2c-match
num_lines = 1
num_keywords = 0
nothing = 0
num_bytes = 353423380
real 0m0.428s
user 0m0.410s
sys 0m0.017s
----- mmap
num_lines = 12032690
num_keywords = 3830430
nothing = 0
real 0m1.315s
user 0m1.287s
sys 0m0.027s
num_matches = 3830430
num_bytes = 353423380
real 0m2.211s
user 0m2.042s
sys 0m0.168s
@andychu
Copy link

andychu commented Nov 13, 2018

Please do a git pull and try the following.

I just exposed the COUNT_RESULTS variable to test if they return the same number of matches. This requires LC_ALL=C on my machine.

$ COUNT_RESULTS=1 ./fixed-strings.sh grep-fixed-benchmark 

FGREP number of results
2969020

----- FGREP


real    0m1.469s
user    0m1.412s
sys     0m0.029s

GREP number of results
2969020

----- GREP


real    0m1.131s
user    0m1.076s
sys     0m0.056s

RIPGREP number of results
2969020

----- RIPGREP


real    0m0.975s
user    0m0.930s
sys     0m0.029s
0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment