Skip to content

Commit dc0fba0

Browse files
committed
Tweak the sort of vtable sizes
1 parent 8e6a193 commit dc0fba0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/rustc_session/src/code_stats.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,13 @@ impl CodeStats {
232232
.map(|(_did, stats)| stats)
233233
.collect::<Vec<_>>();
234234

235-
// Sort by the cost % in reverse order (from biggest to smallest)
235+
// Primary sort: cost % in reverse order (from largest to smallest)
236+
// Secondary sort: trait_name
236237
infos.sort_by(|a, b| {
237-
a.upcasting_cost_percent.total_cmp(&b.upcasting_cost_percent).reverse()
238+
a.upcasting_cost_percent
239+
.total_cmp(&b.upcasting_cost_percent)
240+
.reverse()
241+
.then_with(|| a.trait_name.cmp(&b.trait_name))
238242
});
239243

240244
for VTableSizeInfo {

0 commit comments

Comments
 (0)