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

glob('*.txt') is much slower than it should be on zip files with many recursive files #101

Closed
jaraco opened this issue Jul 12, 2023 · 0 comments

Comments

@jaraco
Copy link
Owner

jaraco commented Jul 12, 2023

glob('*.txt') is much slower than it should be on zip files with many recursive files.

This is because it uses ._descendants() (which lists all recursive descendants) when there's no need, as this glob should only need to read the top-level .iterdir():

for child in self._descendants()

For large zip files, this can easily make a 1000x speed difference, which is surprising when you're writing code that aims to work on both pathlib.Path and zipfile.Path.

Originally posted by @nh2 in #98 (comment)

jaraco added a commit that referenced this issue Jul 14, 2023
jaraco added a commit that referenced this issue Jul 14, 2023
jaraco added a commit that referenced this issue Jul 14, 2023
jaraco added a commit that referenced this issue Jul 14, 2023
jaraco added a commit that referenced this issue Jul 14, 2023
jaraco added a commit that referenced this issue Jul 14, 2023
@jaraco jaraco closed this as completed in f48433d Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant