-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
rg doesn't stop after first match when -q is used #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your first case is pretty pathological, but interesting. The problem is that you're searching for a single byte in a file where that byte is extremely common. It's worth optimizing, but pretty low proirity. Your second case looks like it's on a tiny sample. There's another issue for looking at making startup time faster, since that's almost assuredly what you're observing. Certainly, I don't see any relationship in terms of performance between your examples. |
The intent was to illustrate the performance issue when searching in a single file; those were intended to be different. Moreover, the first one specified |
@0xmohit Oh! I missed the |
But yeah, in the second case, the issue is definitely startup time. I was able to reproduce it.I'm going to lump that part of your issue in with #33, and change the first part to "fix the |
For reference, if we remove the bug from the benchmark,
This suggests |
Clarification,
Benchmarks are hard. :-) |
Oh, yes! Quoting Benchmark_(computing)#Challenges:
|
It seems that this would only stop searching a file after a matched; when searching in a directory, it'll probably still scan all files. Edit: To elaborate:
should probably exit almost immediately. |
Example:
The same was observed while searching in real world code:
The text was updated successfully, but these errors were encountered: