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

avoid indexing every time? #184

Open
wakamex opened this issue May 27, 2023 · 1 comment
Open

avoid indexing every time? #184

wakamex opened this issue May 27, 2023 · 1 comment

Comments

@wakamex
Copy link

wakamex commented May 27, 2023

is there a feasible way to do this? maybe it makes no sense, if displaying file size. but if i'm using this as an ls substitute, it feels weird for it to take 5 seconds every time. maybe let me set an ls alias to use a cached index, then other commands update this index?

@solidiquis
Copy link
Owner

Whether or not to leverage the cache is a decision made by the underlying read_dir API from libc; but rest assured the cache is indeed being utilized automatically. Checkout the following screenshot:

Screen Shot 2023-05-28 at 8 29 47 AM

I color coordinated the highlights for the stats from iostat on the left with the timeed erd runs on the right. You'll notice two things:

  • The subsequent erd run is approx 1.8 times faster than the first
  • The amount of 4KB transfers per second (tps) is lower on the subsequent erd run

This all lends credence to the fact that we're not always making round-trips to the disk when disk data already exists in the cache.

Now as to why erd may not be 100% suitable as an ls alternative: Ultimately in order for us to get disk usage information of directories we need to do a full-depth traversal of a directory's descendants. Even if you were to limit the depth to 1 (-L1), erd accurately reports disk usage information which necessitates the traversal.

There IS an option to --suppress-size but this issue is still ongoing.

Would you want ls-like performance at the cost disk usage information? Could I also ask how you're using erd currently as an ls-alternative?

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

2 participants