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

ls now collects metadata in a separate thread #14627

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

cosineblast
Copy link
Contributor

@cosineblast cosineblast commented Dec 19, 2024

Closes #6174

Description

This PR aims to improve the performance of ls within large directories. ls now delegates the metadata collection to
a thread in its thread pool.

Before:
image

Now:
image

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 from ls.

Tests + Formatting

I do not know if it is a good idea to test this performance with timeit, since it can be unreliable.

@fdncred
Copy link
Collaborator

fdncred commented Dec 19, 2024

very nice! Thanks for working on this. I'm anxious to try it.

@fdncred fdncred added wait-until-after-nushell-release pr:commands This PR changes our commands in some way labels Dec 19, 2024
@WindSoilder WindSoilder merged commit 81baf53 into nushell:main Dec 25, 2024
14 checks passed
@github-actions github-actions bot added this to the v0.102.0 milestone Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:commands This PR changes our commands in some way wait-until-after-nushell-release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ls **/* command is not streaming
3 participants