Skip to content

ls() sorting is expensive... #96

@ConfusedVorlon

Description

@ConfusedVorlon

I was surprised to find that when profiling my app - I'm getting significant hangs with Path.ls()

I can see that you added .sorted() in #58

First comment is that the doc is wrong - it states:

 Same as the `ls` command ∴ output is ”shallow” and unsorted.

Profiling a running app, I'm seeing 0.6 seconds spent doing locale-specific sorting for a not-particularly-huge directory, and a surprisingly large cost for the compactMap()

Image

Not sure what the right approach would be here. I'll probably add an unsorted_ls() command for my own use.

Possible options:

  • Remove the comment that output is unsorted
  • Flag that sorting can be expensive in the docs
  • ListDirectoryOptions: add an unsorted option ??
  • Add a separate unsorted command

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions