twiggy icon indicating copy to clipboard operation
twiggy copied to clipboard

Add summaries to other sub-commands

Open data-pup opened this issue 6 years ago • 3 comments

#84 added a summary to the output of the 'garbage' sub-command, which looks like this:

 Bytes │ Size % │ Garbage Item
───────┼────────┼──────────────────────
    11 ┊  5.58% ┊ unusedAddThreeNumbers
     8 ┊  4.06% ┊ unusedAddOne
   ... ┊    ... ┊ ... and 7 more
    43 ┊ 21.83% ┊ Σ

I think this is a really fantastic idea. Should we add a similar feature to other sub-commands as well? I think the 'top' and 'diff' would be a good start, although I am less sure about the others.

It could be neat to do something similar for the paths command, like this:

               Shallow Bytes │ Shallow %          │ Retaining Paths
───────────────┼───────────┼────────────────────────────
            44 ┊    30.56% ┊ "function names" subsection
             7 ┊     4.86% ┊ export "awoo"
               ┊           ┊   ↳ func[4]
               ┊           ┊       ↳ type[0]
               ┊           ┊       ↳ awoo
               ┊           ┊            ↳ ... and 6 more

(That's imagining what this file might look like)

To Do:

  • [x] diff
  • [x] garbage
  • [x] monos
  • [ ] paths
  • [x] top

data-pup avatar Jul 18 '18 12:07 data-pup

Sounds great to me.

fitzgen avatar Jul 18 '18 14:07 fitzgen

I was thinking more about the comment linked in #84: https://github.com/rustwasm/team/issues/214#issuecomment-405413733

They were using this command: twiggy garbage -n 99999 main_bg.wasm | wc -l

Would it be a good idea to add some sort of --all flag that would ensure that all items are shown? I don't think that would be too hard to take care of, but I'll look into it and follow up. If that should be in a different issue I can open up a new one for that as well.

data-pup avatar Jul 20 '18 00:07 data-pup

--all sounds good to me

fitzgen avatar Jul 20 '18 00:07 fitzgen