From dc0fba02383c6248b8a9dfc780c6448eac706a8f Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 13 Jun 2023 12:39:59 +0000 Subject: [PATCH] Tweak the sort of vtable sizes --- compiler/rustc_session/src/code_stats.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_session/src/code_stats.rs b/compiler/rustc_session/src/code_stats.rs index 51cac328c3a31..cabe1c96bf795 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::>(); - // 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 {