ls
now collects metadata in a separate thread
#14627
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #6174
Description
This PR aims to improve the performance of
ls
within large directories.ls
now delegates the metadata collection toa thread in its thread pool.
Before:
Now:
User-Facing Changes
If an error occurs while file metadata is being collected in another thread, the
ls
command now notifies the user about this error by sending an error value through a channel (which then gets collected into an iterator and shown to the user later on).However, if an error occurs while sending this error value to the channel (i.e the resulting value iterator has been dropped), then the user is not notified of this error. I think this behavior is acceptable, since behavior only occurs when the
ls
pipeline has been dropped and the user is no longer interested in output fromls
.Tests + Formatting
I do not know if it is a good idea to test this performance with
timeit
, since it can be unreliable.