Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 90ec471

Browse files
committedJul 24, 2018
Auto merge of #52672 - ljedrz:unstable_sorts, r=<try>
Prefer sort_unstable*() over sort*() Since `sort_unstable` is considered typically faster than the regular `sort` ([benchmarks](#40601 (comment))), it might be a good idea to check for potential wins in the compiler.
2 parents f498e4e + b520c42 commit 90ec471

File tree

41 files changed

+68
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+68
-68
lines changed
 

‎src/librustc/hir/lowering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4803,6 +4803,6 @@ fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body>) -> Vec<hir::BodyId> {
48034803
// Sorting by span ensures that we get things in order within a
48044804
// file, and also puts the files in a sensible order.
48054805
let mut body_ids: Vec<_> = bodies.keys().cloned().collect();
4806-
body_ids.sort_by_key(|b| bodies[b].value.span);
4806+
body_ids.sort_unstable_by_key(|b| bodies[b].value.span);
48074807
body_ids
48084808
}

‎src/librustc/hir/pat_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl hir::Pat {
157157
}
158158
true
159159
});
160-
variants.sort();
160+
variants.sort_unstable();
161161
variants.dedup();
162162
variants
163163
}

0 commit comments

Comments
 (0)
Please sign in to comment.