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

Consider caching results for faster performance on subsequent runs! #276

Open
debnath-d opened this issue Feb 25, 2025 · 1 comment
Open
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@debnath-d
Copy link

I've been using https://github.com/dundee/gdu for the last few years and started using dua now and really love it. However, one thing that I noticed is that dua doesn't seem to have any kind of caching to speed up results on subsequent runs. gdu seems to use some kind of caching to make it a lot faster on subsequent runs.

Perhaps some form of hashing and hash tables can be used to determine which file-system trees have changed since last run and only calculate those trees again, and use cached results for unchanged trees.

@Byron Byron added enhancement New feature or request help wanted Extra attention is needed labels Feb 26, 2025
@Byron
Copy link
Owner

Byron commented Feb 26, 2025

It would probably be something along the lines of a .git/index, it would have to keep stat information for each directory, and it could skip checking the direct children of a directory if its mtime didn't change. This is, of course, making the assumption that the filesystem will correctly update this value.

In terms of implementation, I'd think the user has to call it with an argument that points to a path at which existing caches can be found, and where it can store the cache for the current run. Implementing this correctly isn't trivial, and all it can try to do is avoid stat calls based mtimes of directories. Maybe I am missing something though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants