binpash / try

Inspect a command's effects before modifying your live system
MIT License
5.17k stars 64 forks source link

`try summary` is noisy and slow #126

Closed mgree closed 1 month ago

mgree commented 9 months ago

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

Less slowness

There are three key stages in summarizing:

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 commented 8 months ago

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.