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

Faster directory checks #5

Merged
merged 4 commits into from
Nov 12, 2018
Merged

Faster directory checks #5

merged 4 commits into from
Nov 12, 2018

Conversation

hltbra
Copy link
Contributor

@hltbra hltbra commented Nov 12, 2018

I saw slows ZREM and HDEL when running large sorted sets, and that was because of the calls to empty_directory() (which calls os.listdir()).

In order to not retrieve information about all files in a given directory just to check if the directory is empty, I added the scandir package as a dependency. Both scandir.scandir and os.listdir() use the C function readdir(), however, with this pull request,scandir.scandir will only call readdir() once.

This showed a ~5% performance improvement for ZREM.

@hltbra hltbra merged commit 134a694 into master Nov 12, 2018
@hltbra hltbra deleted the optimization/scandir branch November 12, 2018 17:29
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

Successfully merging this pull request may close these issues.

1 participant