rustwasm/twiggy

Twiggy dominators depth 1 doesn't add up to the whole file size

alexcrichton opened this issue · 2 comments

Using this wasm file you get:

$ twiggy dominators -d 1 foo.wasm
 Retained Bytes │ Retained % │ Dominator Tree
────────────────┼────────────┼────────────────────────────────────────
          84355 ┊     39.68% ┊ export "format"
          16045 ┊      7.55% ┊ "function names" subsection
          10997 ┊      5.17% ┊ table[0]
           3465 ┊      1.63% ┊ func[18]
           1836 ┊      0.86% ┊ func[86]
           1199 ┊      0.56% ┊ func[26]
           1059 ┊      0.50% ┊ func[104]
            965 ┊      0.45% ┊ func[2]
            710 ┊      0.33% ┊ func[96]
            340 ┊      0.16% ┊ func[149]
            327 ┊      0.15% ┊ func[150]
            261 ┊      0.12% ┊ func[158]
            140 ┊      0.07% ┊ func[52]
            140 ┊      0.07% ┊ func[74]
            138 ┊      0.06% ┊ func[155]
            137 ┊      0.06% ┊ func[50]
            125 ┊      0.06% ┊ func[92]
            117 ┊      0.06% ┊ func[119]
            106 ┊      0.05% ┊ func[14]
             87 ┊      0.04% ┊ func[108]
             75 ┊      0.04% ┊ func[146]
             70 ┊      0.03% ┊ func[201]
             63 ┊      0.03% ┊ export "__wbindgen_malloc"
             56 ┊      0.03% ┊ func[199]
             53 ┊      0.02% ┊ func[93]
             42 ┊      0.02% ┊ export "__wbindgen_global_argument_ptr"
             34 ┊      0.02% ┊ export "__wbindgen_free"
             28 ┊      0.01% ┊ export "__indirect_function_table"
             22 ┊      0.01% ┊ export "__heap_base"
             21 ┊      0.01% ┊ export "__data_end"
             12 ┊      0.01% ┊ func[87]
             11 ┊      0.01% ┊ export "memory"
              8 ┊      0.00% ┊ type[10]
              8 ┊      0.00% ┊ global[0]
              7 ┊      0.00% ┊ type[4]
              7 ┊      0.00% ┊ type[11]
              6 ┊      0.00% ┊ type[3]
              6 ┊      0.00% ┊ type[7]
              5 ┊      0.00% ┊ type[5]
              5 ┊      0.00% ┊ type[8]
              5 ┊      0.00% ┊ type[14]
              4 ┊      0.00% ┊ type[0]
              4 ┊      0.00% ┊ type[1]
              3 ┊      0.00% ┊ type[6]

The file itself is 212k bytes, but the numbers on the left don't seem to add up to that. Is some data left out by accident perhaps?

This is most likely "garbage" that we can't figure out how it is referenced from any function. We should add some sort of total unreachable stuff row to this output.

Working on this now, pardon the delay! Took care of text output today, should be able to fix the csv and json output & put a PR for this up shortly!