Skip to content

Commit

Permalink
Add summaries to monos sub-command output.
Browse files Browse the repository at this point in the history
  • Loading branch information
data-pup committed Aug 3, 2018
1 parent 2718850 commit a0a30da
Show file tree
Hide file tree
Showing 8 changed files with 339 additions and 192 deletions.
371 changes: 254 additions & 117 deletions analyze/analyze.rs

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions ir/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@ impl Items {
.expect(
"Cannot call retained_sizes unless compute_retained_sizes \
has already been called",
)
.get(&id)
).get(&id)
.cloned()
.unwrap()
}
Expand Down
3 changes: 2 additions & 1 deletion twiggy/tests/expectations/cpp_monos
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Apprx. Bloat Bytes β”‚ Apprx. Bloat % β”‚ Bytes β”‚ % β”‚ Monomorphizations
────────────────────┼────────────────┼───────┼───────┼─────────────────────────
14 β”Š 3.01% β”Š 21 β”Š 4.52% β”Š void generic
β”Š β”Š 7 β”Š 1.51% β”Š void generic<Zero>()
β”Š β”Š 7 β”Š 1.51% β”Š void generic<One>()
β”Š β”Š 7 β”Š 1.51% β”Š void generic<Two>()
β”Š β”Š 7 β”Š 1.51% β”Š void generic<Zero>()
14 β”Š 3.01% β”Š 21 β”Š 4.52% β”Š Ξ£ [4 Total Rows]
102 changes: 52 additions & 50 deletions twiggy/tests/expectations/monos
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
Apprx. Bloat Bytes β”‚ Apprx. Bloat % β”‚ Bytes β”‚ % β”‚ Monomorphizations
────────────────────┼────────────────┼───────┼───────┼────────────────────────────────────────────────────────────────────────────────────────────────────
1977 β”Š 3.40% β”Š 3003 β”Š 5.16% β”Š alloc::slice::merge_sort
β”Š β”Š 1026 β”Š 1.76% β”Š alloc::slice::merge_sort::hb3d195f9800bdad6
β”Š β”Š 1026 β”Š 1.76% β”Š alloc::slice::merge_sort::hfcf2318d7dc71d03
β”Š β”Š 951 β”Š 1.63% β”Š alloc::slice::merge_sort::hcfca67f5c75a52ef
1302 β”Š 2.24% β”Š 3996 β”Š 6.87% β”Š <&'a T as core::fmt::Debug>::fmt
β”Š β”Š 2694 β”Š 4.63% β”Š <&'a T as core::fmt::Debug>::fmt::h1c27955d8de3ff17
β”Š β”Š 568 β”Š 0.98% β”Š <&'a T as core::fmt::Debug>::fmt::hea6a77c4dcddb7ac
β”Š β”Š 433 β”Š 0.74% β”Š <&'a T as core::fmt::Debug>::fmt::hfbacf6f5c9f53bb2
β”Š β”Š 301 β”Š 0.52% β”Š <&'a T as core::fmt::Debug>::fmt::h199e8e1c5752e6f1
973 β”Š 1.67% β”Š 1118 β”Š 1.92% β”Š core::result::unwrap_failed
β”Š β”Š 145 β”Š 0.25% β”Š core::result::unwrap_failed::h9bd27c3a9ad7c001
β”Š β”Š 145 β”Š 0.25% β”Š core::result::unwrap_failed::h4cc73eb9bf19ce32
β”Š β”Š 145 β”Š 0.25% β”Š core::result::unwrap_failed::h137aa4f433aba1a9
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::ha3e58cfc7f422ab4
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::h9a7678774db14d67
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::hcb258ce32bda3d85
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::ha7651fcaac40f701
β”Š β”Š 131 β”Š 0.23% β”Š core::result::unwrap_failed::hcfddf900474e698a
558 β”Š 0.96% β”Š 714 β”Š 1.23% β”Š <alloc::raw_vec::RawVec<T, A>>::double
β”Š β”Š 156 β”Š 0.27% β”Š <alloc::raw_vec::RawVec<T, A>>::double::h28f86621ee2a10aa
β”Š β”Š 156 β”Š 0.27% β”Š <alloc::raw_vec::RawVec<T, A>>::double::h956450b93bdc9e1e
β”Š β”Š 156 β”Š 0.27% β”Š <alloc::raw_vec::RawVec<T, A>>::double::hcb2fb5861b96a3b0
β”Š β”Š 147 β”Š 0.25% β”Š <alloc::raw_vec::RawVec<T, A>>::double::ha715b4e5cc3c60ae
β”Š β”Š 99 β”Š 0.17% β”Š <alloc::raw_vec::RawVec<T, A>>::double::h77ff8547127c5db2
512 β”Š 0.88% β”Š 798 β”Š 1.37% β”Š std::thread::local::os::destroy_value
β”Š β”Š 286 β”Š 0.49% β”Š std::thread::local::os::destroy_value::hca8124786bee4a79
β”Š β”Š 281 β”Š 0.48% β”Š std::thread::local::os::destroy_value::h094cf4f2a025ba2b
β”Š β”Š 231 β”Š 0.40% β”Š std::thread::local::os::destroy_value::h453d41f6c315da32
234 β”Š 0.40% β”Š 354 β”Š 0.61% β”Š alloc::slice::insert_head
β”Š β”Š 120 β”Š 0.21% β”Š alloc::slice::insert_head::haf6e08236bab8bde
β”Š β”Š 120 β”Š 0.21% β”Š alloc::slice::insert_head::h2cdb84a455761146
β”Š β”Š 114 β”Š 0.20% β”Š alloc::slice::insert_head::hed0e79da03eeec8b
196 β”Š 0.34% β”Š 294 β”Š 0.51% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt
β”Š β”Š 98 β”Š 0.17% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt::h1b74a5fafe15c8eb
β”Š β”Š 98 β”Š 0.17% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt::h24034d1c07bfae93
β”Š β”Š 98 β”Š 0.17% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt::h5ebed3e159974658
195 β”Š 0.34% β”Š 270 β”Š 0.46% β”Š <alloc::vec::Vec<T>>::push
β”Š β”Š 75 β”Š 0.13% β”Š <alloc::vec::Vec<T>>::push::h98b02eda22d1ca25
β”Š β”Š 66 β”Š 0.11% β”Š <alloc::vec::Vec<T>>::push::hc927b4bedb35b00d
β”Š β”Š 66 β”Š 0.11% β”Š <alloc::vec::Vec<T>>::push::h5729b9e7651ef67b
β”Š β”Š 63 β”Š 0.11% β”Š <alloc::vec::Vec<T>>::push::h9415ef699ccc65d8
119 β”Š 0.20% β”Š 180 β”Š 0.31% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut
β”Š β”Š 61 β”Š 0.10% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut::hba42cce6d0c0099b
β”Š β”Š 61 β”Š 0.10% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut::hbf8fcfe76c1f6657
β”Š β”Š 58 β”Š 0.10% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut::h1c053f01b6f95d93
95 β”Š 0.16% β”Š 190 β”Š 0.33% β”Š core::fmt::Write::write_fmt
β”Š β”Š 95 β”Š 0.16% β”Š core::fmt::Write::write_fmt::ha5ae3249cacba520
β”Š β”Š 95 β”Š 0.16% β”Š core::fmt::Write::write_fmt::hef4632e1398f5ac8
Apprx. Bloat Bytes β”‚ Apprx. Bloat % β”‚ Bytes β”‚ % β”‚ Monomorphizations
────────────────────┼────────────────┼───────┼────────┼────────────────────────────────────────────────────────────────────────────────────────────────────
1977 β”Š 3.40% β”Š 3003 β”Š 5.16% β”Š alloc::slice::merge_sort
β”Š β”Š 1026 β”Š 1.76% β”Š alloc::slice::merge_sort::hb3d195f9800bdad6
β”Š β”Š 1026 β”Š 1.76% β”Š alloc::slice::merge_sort::hfcf2318d7dc71d03
β”Š β”Š 951 β”Š 1.63% β”Š alloc::slice::merge_sort::hcfca67f5c75a52ef
1302 β”Š 2.24% β”Š 3996 β”Š 6.87% β”Š <&'a T as core::fmt::Debug>::fmt
β”Š β”Š 2694 β”Š 4.63% β”Š <&'a T as core::fmt::Debug>::fmt::h1c27955d8de3ff17
β”Š β”Š 568 β”Š 0.98% β”Š <&'a T as core::fmt::Debug>::fmt::hea6a77c4dcddb7ac
β”Š β”Š 433 β”Š 0.74% β”Š <&'a T as core::fmt::Debug>::fmt::hfbacf6f5c9f53bb2
β”Š β”Š 301 β”Š 0.52% β”Š <&'a T as core::fmt::Debug>::fmt::h199e8e1c5752e6f1
973 β”Š 1.67% β”Š 1118 β”Š 1.92% β”Š core::result::unwrap_failed
β”Š β”Š 145 β”Š 0.25% β”Š core::result::unwrap_failed::h137aa4f433aba1a9
β”Š β”Š 145 β”Š 0.25% β”Š core::result::unwrap_failed::h4cc73eb9bf19ce32
β”Š β”Š 145 β”Š 0.25% β”Š core::result::unwrap_failed::h9bd27c3a9ad7c001
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::h9a7678774db14d67
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::ha3e58cfc7f422ab4
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::ha7651fcaac40f701
β”Š β”Š 138 β”Š 0.24% β”Š core::result::unwrap_failed::hcb258ce32bda3d85
β”Š β”Š 131 β”Š 0.23% β”Š core::result::unwrap_failed::hcfddf900474e698a
558 β”Š 0.96% β”Š 714 β”Š 1.23% β”Š <alloc::raw_vec::RawVec<T, A>>::double
β”Š β”Š 156 β”Š 0.27% β”Š <alloc::raw_vec::RawVec<T, A>>::double::h28f86621ee2a10aa
β”Š β”Š 156 β”Š 0.27% β”Š <alloc::raw_vec::RawVec<T, A>>::double::h956450b93bdc9e1e
β”Š β”Š 156 β”Š 0.27% β”Š <alloc::raw_vec::RawVec<T, A>>::double::hcb2fb5861b96a3b0
β”Š β”Š 147 β”Š 0.25% β”Š <alloc::raw_vec::RawVec<T, A>>::double::ha715b4e5cc3c60ae
β”Š β”Š 99 β”Š 0.17% β”Š <alloc::raw_vec::RawVec<T, A>>::double::h77ff8547127c5db2
512 β”Š 0.88% β”Š 798 β”Š 1.37% β”Š std::thread::local::os::destroy_value
β”Š β”Š 286 β”Š 0.49% β”Š std::thread::local::os::destroy_value::hca8124786bee4a79
β”Š β”Š 281 β”Š 0.48% β”Š std::thread::local::os::destroy_value::h094cf4f2a025ba2b
β”Š β”Š 231 β”Š 0.40% β”Š std::thread::local::os::destroy_value::h453d41f6c315da32
234 β”Š 0.40% β”Š 354 β”Š 0.61% β”Š alloc::slice::insert_head
β”Š β”Š 120 β”Š 0.21% β”Š alloc::slice::insert_head::h2cdb84a455761146
β”Š β”Š 120 β”Š 0.21% β”Š alloc::slice::insert_head::haf6e08236bab8bde
β”Š β”Š 114 β”Š 0.20% β”Š alloc::slice::insert_head::hed0e79da03eeec8b
196 β”Š 0.34% β”Š 294 β”Š 0.51% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt
β”Š β”Š 98 β”Š 0.17% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt::h1b74a5fafe15c8eb
β”Š β”Š 98 β”Š 0.17% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt::h24034d1c07bfae93
β”Š β”Š 98 β”Š 0.17% β”Š <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_fmt::h5ebed3e159974658
195 β”Š 0.34% β”Š 270 β”Š 0.46% β”Š <alloc::vec::Vec<T>>::push
β”Š β”Š 75 β”Š 0.13% β”Š <alloc::vec::Vec<T>>::push::h98b02eda22d1ca25
β”Š β”Š 66 β”Š 0.11% β”Š <alloc::vec::Vec<T>>::push::h5729b9e7651ef67b
β”Š β”Š 66 β”Š 0.11% β”Š <alloc::vec::Vec<T>>::push::hc927b4bedb35b00d
β”Š β”Š 63 β”Š 0.11% β”Š <alloc::vec::Vec<T>>::push::h9415ef699ccc65d8
119 β”Š 0.20% β”Š 180 β”Š 0.31% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut
β”Š β”Š 61 β”Š 0.10% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut::hba42cce6d0c0099b
β”Š β”Š 61 β”Š 0.10% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut::hbf8fcfe76c1f6657
β”Š β”Š 58 β”Š 0.10% β”Š <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index_mut::h1c053f01b6f95d93
95 β”Š 0.16% β”Š 190 β”Š 0.33% β”Š core::fmt::Write::write_fmt
β”Š β”Š 95 β”Š 0.16% β”Š core::fmt::Write::write_fmt::ha5ae3249cacba520
β”Š β”Š 95 β”Š 0.16% β”Š core::fmt::Write::write_fmt::hef4632e1398f5ac8
298 β”Š 0.51% β”Š 24063 β”Š 41.34% β”Š ... and 187 more.
6459 β”Š 11.10% β”Š 34980 β”Š 60.10% β”Š Ξ£ [235 Total Rows]
2 changes: 1 addition & 1 deletion twiggy/tests/expectations/monos_json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"generic":"alloc::slice::merge_sort","approximate_monomorphization_bloat_bytes":1977,"approximate_monomorphization_bloat_percent":3.396673768125902,"total_size":3003,"total_size_percent":5.159439213799739,"monomorphizations":[{"name":"alloc::slice::merge_sort::hb3d195f9800bdad6","shallow_size":1026,"shallow_size_percent":1.7627654456738369}]},{"generic":"<&'a T as core::fmt::Debug>::fmt","approximate_monomorphization_bloat_bytes":1302,"approximate_monomorphization_bloat_percent":2.2369596591299565,"total_size":3996,"total_size_percent":6.865507525255995,"monomorphizations":[{"name":"<&'a T as core::fmt::Debug>::fmt::h1c27955d8de3ff17","shallow_size":2694,"shallow_size_percent":4.6285478661260395}]}]
[{"generic":"alloc::slice::merge_sort","approximate_monomorphization_bloat_bytes":1977,"approximate_monomorphization_bloat_percent":3.396673768125902,"total_size":3003,"total_size_percent":5.159439213799739,"monomorphizations":[{"name":"alloc::slice::merge_sort::hb3d195f9800bdad6","shallow_size":1026,"shallow_size_percent":1.7627654456738369},{"name":"... and 2 more.","shallow_size":1977,"shallow_size_percent":3.396673768125902}]},{"generic":"<&'a T as core::fmt::Debug>::fmt","approximate_monomorphization_bloat_bytes":1302,"approximate_monomorphization_bloat_percent":2.2369596591299565,"total_size":3996,"total_size_percent":6.865507525255995,"monomorphizations":[{"name":"<&'a T as core::fmt::Debug>::fmt::h1c27955d8de3ff17","shallow_size":2694,"shallow_size_percent":4.6285478661260395},{"name":"... and 3 more.","shallow_size":1302,"shallow_size_percent":2.2369596591299565}]},{"generic":"... and 196 more.","approximate_monomorphization_bloat_bytes":3180,"approximate_monomorphization_bloat_percent":5.46354202460312,"total_size":27981,"total_size_percent":48.07401553157858,"monomorphizations":[]},{"generic":"Ξ£ [202 Total Rows]","approximate_monomorphization_bloat_bytes":6459,"approximate_monomorphization_bloat_percent":11.097175451858979,"total_size":34980,"total_size_percent":60.09896227063432,"monomorphizations":[]}]
16 changes: 10 additions & 6 deletions twiggy/tests/expectations/monos_maxes
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Apprx. Bloat Bytes β”‚ Apprx. Bloat % β”‚ Bytes β”‚ % β”‚ Monomorphizations
────────────────────┼────────────────┼───────┼───────┼────────────────────────────────────────────────────────
1977 β”Š 3.40% β”Š 3003 β”Š 5.16% β”Š alloc::slice::merge_sort
β”Š β”Š 1026 β”Š 1.76% β”Š alloc::slice::merge_sort::hb3d195f9800bdad6
1302 β”Š 2.24% β”Š 3996 β”Š 6.87% β”Š <&'a T as core::fmt::Debug>::fmt
β”Š β”Š 2694 β”Š 4.63% β”Š <&'a T as core::fmt::Debug>::fmt::h1c27955d8de3ff17
Apprx. Bloat Bytes β”‚ Apprx. Bloat % β”‚ Bytes β”‚ % β”‚ Monomorphizations
────────────────────┼────────────────┼───────┼────────┼────────────────────────────────────────────────────────
1977 β”Š 3.40% β”Š 3003 β”Š 5.16% β”Š alloc::slice::merge_sort
β”Š β”Š 1026 β”Š 1.76% β”Š alloc::slice::merge_sort::hb3d195f9800bdad6
β”Š β”Š 1977 β”Š 3.40% β”Š ... and 2 more.
1302 β”Š 2.24% β”Š 3996 β”Š 6.87% β”Š <&'a T as core::fmt::Debug>::fmt
β”Š β”Š 2694 β”Š 4.63% β”Š <&'a T as core::fmt::Debug>::fmt::h1c27955d8de3ff17
β”Š β”Š 1302 β”Š 2.24% β”Š ... and 3 more.
3180 β”Š 5.46% β”Š 27981 β”Š 48.07% β”Š ... and 196 more.
6459 β”Š 11.10% β”Š 34980 β”Š 60.10% β”Š Ξ£ [202 Total Rows]
Loading

0 comments on commit a0a30da

Please sign in to comment.