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

try summary is noisy and slow #126

Open
mgree opened this issue Oct 20, 2023 · 1 comment
Open

try summary is noisy and slow #126

mgree opened this issue Oct 20, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mgree
Copy link
Contributor

mgree commented Oct 20, 2023

When @ericzty demoed try installing rust at the recent pash retreat, try was fast but the summary was painfully slow and very noisy. The problem is in the summary() routine.

We should not be slow or noisy.

Less noise

  • If a directory is new, just give its name, the number of files under it, and the total space consumed. A user can use try explore to see details if they care.
  • If a whole subtree is deleted, just give its name, the number of files under it, and the total space taken up by the files deleted.
  • Give full detail on everything else.

Less slowness

There are three key stages in summarizing:

  • The call to find in find_upperdir_changes
  • The diffing with the root filesystem in process_changes
  • The reporting in summary

I suspect the diffing and reporting are the slow part. (Being less noisy means less printing, which of course means less slowness. Still waters run fast.) But we should profile this and find out. It may be necessary to replace process_changes with a short C program.

@mgree mgree added the enhancement New feature or request label Oct 20, 2023
@mgree
Copy link
Contributor Author

mgree commented Oct 21, 2023

This should be relatively easy to achieve with fts, which we can use in the following way:

  1. fts_open the upperdir
  2. Walk through, comparing against the lowerdir. (Cf. overlayfs-tools traverse function.)
    a. On a new directory in the upperdir, use fts_children to compute # of files and their total disk usage.
    b. On a whiteout of what was a directory in the lowerdir, a separate call to fts_open on the lowerdir (or simply calling out to du) will tell else how many files were deleted.
  3. Generate the summary and---if requested---a shell script that does the merge. Then the commit routine can just directly call this script.

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

No branches or pull requests

1 participant