-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
bugA bug.A bug.
Description
Please tick this box to confirm you have reviewed the above.
- I have a different issue.
What version of ripgrep are you using?
rg --version
ripgrep 14.1.1
features:-pcre2
simd(compile):+SSE2,-SSSE3,-AVX2
simd(runtime):+SSE2,+SSSE3,+AVX2
PCRE2 is not available in this build of ripgrep.
How did you install ripgrep?
emerge
What operating system are you using ripgrep on?
Gentoo
Describe your bug.
On large files, rg seems to slow down significantly with larger -A values.
$ ls -lh large_file
> -rwxr-xr-x 1 XXX XXX 9.8G Oct 10 11:35 large_file
$ time cat large_file | rg XXXXX -A99
binary file matches (found "\0" byte around offset 7)
________________________________________________________
Executed in 334.68 millis fish external
usr time 260.39 millis 2.94 millis 257.45 millis
sys time 75.03 millis 0.99 millis 74.04 millis
$ time cat large_file | rg XXXXX -A999
binary file matches (found "\0" byte around offset 7)
________________________________________________________
Executed in 349.03 millis fish external
usr time 269.92 millis 1.57 millis 268.36 millis
sys time 91.83 millis 1.02 millis 90.81 millis
$ time cat large_file | rg XXXXX -A9999
binary file matches (found "\0" byte around offset 7)
________________________________________________________
Executed in 667.18 millis fish external
usr time 565.68 millis 1.62 millis 564.06 millis
sys time 103.22 millis 1.02 millis 102.20 millis
$ time cat large_file | rg XXXXX -A99999
binary file matches (found "\0" byte around offset 7)
________________________________________________________
Executed in 3.39 secs fish external
usr time 3.27 secs 0.73 millis 3.27 secs
sys time 0.12 secs 2.01 millis 0.12 secs
$ time cat large_file | rg XXXXX -A999999
binary file matches (found "\0" byte around offset 7)
________________________________________________________
Executed in 28.48 secs fish external
usr time 28.29 secs 0.82 millis 28.28 secs
sys time 0.14 secs 2.01 millis 0.13 secs
$ time cat large_file | rg XXXXX -A9999999
binary file matches (found "\0" byte around offset 7)
________________________________________________________
Executed in 235.28 secs fish external
usr time 234.74 secs 2.70 millis 234.73 secs
sys time 0.18 secs 1.02 millis 0.18 secsThe larger the context window, the longer it takes, it seems.
Compare that to grep:
$ time cat large_file | grep XXXXX -A99
grep: (standard input): binary file matches
________________________________________________________
Executed in 5.54 secs fish external
usr time 0.23 secs 1.46 millis 0.23 secs
sys time 5.29 secs 2.04 millis 5.28 secs
$ time cat large_file | grep XXXXX -A999
grep: (standard input): binary file matches
________________________________________________________
Executed in 5.56 secs fish external
usr time 0.22 secs 1.00 millis 0.22 secs
sys time 5.34 secs 2.97 millis 5.34 secs
$ time cat large_file | grep XXXXX -A9999
grep: (standard input): binary file matches
________________________________________________________
Executed in 5.50 secs fish external
usr time 0.24 secs 1.12 millis 0.23 secs
sys time 5.27 secs 3.08 millis 5.27 secs
$ time cat large_file | grep XXXXX -A99999
grep: (standard input): binary file matches
________________________________________________________
Executed in 5.53 secs fish external
usr time 0.22 secs 0.27 millis 0.22 secs
sys time 5.30 secs 3.03 millis 5.30 secs
$ time cat large_file | grep XXXXX -A999999
grep: (standard input): binary file matches
________________________________________________________
Executed in 5.36 secs fish external
usr time 0.20 secs 1.32 millis 0.20 secs
sys time 5.18 secs 2.03 millis 5.18 secs
$ time cat large_file | grep XXXXX -A9999999
grep: (standard input): binary file matches
________________________________________________________
Executed in 5.48 secs fish external
usr time 0.23 secs 0.00 millis 0.23 secs
sys time 5.25 secs 2.94 millis 5.25 secsThis is very unfortunate behavior, as it means that grep can, in fact, not rest in peace.
What are the steps to reproduce the behavior?
See above.
What is the actual behavior?
It's slow.
What is the expected behavior?
It should be faster.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugA bug.A bug.