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

stream results when feasible #4

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

stream results when feasible #4

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

Comments

@BurntSushi
Copy link
Owner

Currently, all search results are written to an intermediate buffer in memory before being actually emitted to stdout. This is done to permit more efficient parallelism when searching. That is, only one thread can be writing to stdout at any point in time, but multiple threads can write to their own thread local memory buffer.

This does have undesirable end user consequences:

  1. It can result in high memory usage when the number of search results is high.
  2. When searching a single file, no output is seen until the search is complete.

We should be able to do quite a bit to fix these issues:

  1. If a single file is given to search, then don't try any parallelism and make searching write to stdout directly.
  2. If --threads 1 is given, then do (1) regardless of the number of inputs.
@BurntSushi BurntSushi added the enhancement An enhancement to the functionality of the software. label Sep 13, 2016
@BurntSushi
Copy link
Owner Author

This is done, but I opted to only do it for searching single files or stdin. Setting --threads 1 will still use the intermediate buffer.

amsharma91 added a commit to amsharma91/ripgrep that referenced this issue Sep 27, 2016
For example, when only a single file (or stdin) is being searched, then we
should be able to print directly to the terminal instead of intermediate
buffers. (The buffers are only necessary for parallelism.)

Closes BurntSushi#4.
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