diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-06-13 12:39:59 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-06-13 12:39:59 +0000 |
| commit | dc0fba02383c6248b8a9dfc780c6448eac706a8f (patch) | |
| tree | d5be699635e809c94a73118f078c3c8b881d0f99 | |
| parent | 8e6a193946eea931c44caecfdd3c3353d036335b (diff) | |
Tweak the sort of vtable sizes
| -rw-r--r-- | compiler/rustc_session/src/code_stats.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/code_stats.rs b/compiler/rustc_session/src/code_stats.rs index 51cac328c3a..cabe1c96bf7 100644 --- a/compiler/rustc_session/src/code_stats.rs +++ b/compiler/rustc_session/src/code_stats.rs @@ -232,9 +232,13 @@ impl CodeStats { .map(|(_did, stats)| stats) .collect::<Vec<_>>(); - // Sort by the cost % in reverse order (from biggest to smallest) + // Primary sort: cost % in reverse order (from largest to smallest) + // Secondary sort: trait_name infos.sort_by(|a, b| { - a.upcasting_cost_percent.total_cmp(&b.upcasting_cost_percent).reverse() + a.upcasting_cost_percent + .total_cmp(&b.upcasting_cost_percent) + .reverse() + .then_with(|| a.trait_name.cmp(&b.trait_name)) }); for VTableSizeInfo { |
