Skip to content

ls now collects metadata in a separate thread - #14627

Merged
WindSoilder merged 1 commit into
nushell:mainfrom
cosineblast:speedup-ls
Dec 25, 2024
Merged

WindSoilder merged 1 commit into
nushell:mainfrom
cosineblast:speedup-ls

Conversation

@cosineblast

@cosineblast cosineblast commented Dec 19, 2024 •

Copy link
Copy Markdown
Contributor

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

fdncred commented Dec 19, 2024

Copy link
Copy Markdown
Contributor

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

@fdncred fdncred added status:wait-until-after-nushell-release deprecated:pr-commands (deprecated: too vague) This PR changes our commands in some way labels Dec 19, 2024
@WindSoilder
WindSoilder merged commit 81baf53 into nushell:main Dec 25, 2024
@github-actions github-actions Bot added this to the v0.102.0 milestone Dec 25, 2024
@cosineblast
cosineblast deleted the speedup-ls branch February 17, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecated:pr-commands (deprecated: too vague) This PR changes our commands in some way status: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