Skip to content
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

switch default thread count to cpus - 1 instead of cpus #46

Closed
BurntSushi opened this issue Sep 24, 2016 · 1 comment
Closed

switch default thread count to cpus - 1 instead of cpus #46

BurntSushi opened this issue Sep 24, 2016 · 1 comment
Labels
enhancement An enhancement to the functionality of the software.

Comments

@BurntSushi
Copy link
Owner

It makes sense to not use one thread more than the number of CPUs you have. Namely, -j launches N workers for searching, while the main thread does directory traversal.

Ideally, cpus would be the number of physical cores (i.e., not counting hyper threading).

@BurntSushi BurntSushi added the enhancement An enhancement to the functionality of the software. label Sep 24, 2016
@BurntSushi
Copy link
Owner Author

Maybe a better approach here would be to subtract 1 from -j, since that might match more closely to what users expect (and would actually be accurate, since -j is short for --threads).

BurntSushi added a commit that referenced this issue Sep 25, 2016
[Fixes #46] Use 1 less worker thread than number of threads
amsharma91 added a commit to amsharma91/ripgrep that referenced this issue Sep 27, 2016
The main thread does directory traversal. Hence
number of threads = main Thread + number of worker threads.
We should have atleast one worker thread.
amsharma91 added a commit to amsharma91/ripgrep that referenced this issue Sep 27, 2016
[Fixes BurntSushi#46] Use 1 less worker thread than number of threads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to the functionality of the software.
Projects
None yet
Development

No branches or pull requests

1 participant