Skip to content

Instantly share code, notes, and snippets.

@hgoscenski
Last active June 18, 2018 15:55
Show Gist options
  • Save hgoscenski/059ab6394b3c0520e37d34c448b69d98 to your computer and use it in GitHub Desktop.
Save hgoscenski/059ab6394b3c0520e37d34c448b69d98 to your computer and use it in GitHub Desktop.
Timing for ripgrep vs. BSD grep vs. GNU grep
hgoscenski@hgoscenski-ltm:~/Downloads
λ grep --version 0
grep (BSD grep) 2.5.1-FreeBSD
hgoscenski@hgoscenski-ltm:~/Downloads
λ ggrep --version 0
ggrep (GNU grep) 3.1
Packaged by Homebrew
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
hgoscenski@hgoscenski-ltm:~/Downloads
λ rg --version 0
ripgrep 0.8.1
-SIMD -AVX
hgoscenski@hgoscenski-ltm:~/Downloads
λ time grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 2.29s user 0.21s system 97% cpu 2.574 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 2.17s user 0.19s system 98% cpu 2.391 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 2.24s user 0.19s system 98% cpu 2.455 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
grep -Ev "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 2.21s user 0.20s system 96% cpu 2.506 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.28s user 0.56s system 90% cpu 0.929 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.28s user 0.53s system 97% cpu 0.830 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.28s user 0.53s system 97% cpu 0.836 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
rg -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.28s user 0.54s system 94% cpu 0.860 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.08s user 0.15s system 67% cpu 0.334 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.08s user 0.13s system 91% cpu 0.233 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.08s user 0.15s system 90% cpu 0.258 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt
ggrep -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.08s user 0.16s system 83% cpu 0.284 total
# RG WITH DEBUG ON
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt 0
DEBUG/grep::search/grep/src/search.rs:195: regex ast:
Alternate(
[
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'6',
' ',
'0'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '8'
}
]
}
)
]
),
i: Some(
1
),
name: None
},
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'7',
' '
],
casei: false
},
Group {
e: Alternate(
[
Concat(
[
Literal {
chars: [
'1'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '2',
end: '9'
}
]
}
)
]
),
Concat(
[
Literal {
chars: [
'2'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '3'
}
]
}
)
]
)
]
),
i: Some(
3
),
name: None
}
]
),
i: Some(
2
),
name: None
}
]
)
DEBUG/grep::literals/grep/src/literals.rs:88: required literal found: "Jun 0"
rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.28s user 0.55s system 88% cpu 0.945 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt 0
DEBUG/grep::search/grep/src/search.rs:195: regex ast:
Alternate(
[
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'6',
' ',
'0'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '8'
}
]
}
)
]
),
i: Some(
1
),
name: None
},
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'7',
' '
],
casei: false
},
Group {
e: Alternate(
[
Concat(
[
Literal {
chars: [
'1'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '2',
end: '9'
}
]
}
)
]
),
Concat(
[
Literal {
chars: [
'2'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '3'
}
]
}
)
]
)
]
),
i: Some(
3
),
name: None
}
]
),
i: Some(
2
),
name: None
}
]
)
DEBUG/grep::literals/grep/src/literals.rs:88: required literal found: "Jun 0"
rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.28s user 0.55s system 95% cpu 0.874 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt 0
DEBUG/grep::search/grep/src/search.rs:195: regex ast:
Alternate(
[
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'6',
' ',
'0'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '8'
}
]
}
)
]
),
i: Some(
1
),
name: None
},
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'7',
' '
],
casei: false
},
Group {
e: Alternate(
[
Concat(
[
Literal {
chars: [
'1'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '2',
end: '9'
}
]
}
)
]
),
Concat(
[
Literal {
chars: [
'2'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '3'
}
]
}
)
]
)
]
),
i: Some(
3
),
name: None
}
]
),
i: Some(
2
),
name: None
}
]
)
DEBUG/grep::literals/grep/src/literals.rs:88: required literal found: "Jun 0"
rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.27s user 0.53s system 94% cpu 0.850 total
hgoscenski@hgoscenski-ltm:~/Downloads
λ time rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > noc_9512v4.txt 0
DEBUG/grep::search/grep/src/search.rs:195: regex ast:
Alternate(
[
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'6',
' ',
'0'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '8'
}
]
}
)
]
),
i: Some(
1
),
name: None
},
Group {
e: Concat(
[
Literal {
chars: [
'J',
'u',
'n',
' ',
'0',
'7',
' '
],
casei: false
},
Group {
e: Alternate(
[
Concat(
[
Literal {
chars: [
'1'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '2',
end: '9'
}
]
}
)
]
),
Concat(
[
Literal {
chars: [
'2'
],
casei: false
},
Class(
CharClass {
ranges: [
ClassRange {
start: '0',
end: '3'
}
]
}
)
]
)
]
),
i: Some(
3
),
name: None
}
]
),
i: Some(
2
),
name: None
}
]
)
DEBUG/grep::literals/grep/src/literals.rs:88: required literal found: "Jun 0"
rg --debug -v "(Jun 06 0[0-8])|(Jun 07 (1[2-9]|2[0-3]))" noc_9512v2.txt > 0.28s user 0.54s system 95% cpu 0.851 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment