fsspec / fsspec/filesystem_spec

`LocalFileSystem.ls()` with `details=False` slow

Open
#1,788 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

Hi fsspec developers,

I realized when using a later version of fsspec than the ones from 2023 that the .ls() was super slow. The reason came in in this issue PR: #1479 where always the info is taken for all files

Image

and then thrown away - for a large number of files this can become costly and the detail flag can not be used to reduce work. Before the mentioned PR the os.listdir was used which just list the number of files.

I just wanted to ask if I can open a PR in which thels used the os.listdir again for detail=False and if the path is a file it will just return the path to the file - no much use to call it for a file with not details but should of cours work. And if the details=True the code stays as is?

Let me know what you think.

Best
Frank

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at LocalFileSystem.ls() and compare its current behavior with the os.listdir approach described in the issue and PR #1479. Check both details=False and details=True, including the case where the path is a file. Done means details=False avoids collecting discarded info while details=True retains its existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.