Skip to content

Commit

Permalink
sorting unstably
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxLisk committed Apr 22, 2019
1 parent 8cbc985 commit 440738b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -20,3 +20,4 @@ opt-level = 2

[profile.release]
lto = true
debug = true
3 changes: 2 additions & 1 deletion src/life.rs
Expand Up @@ -411,7 +411,8 @@ impl WorldState {
let mut rank = 7;
let mut file = 0;
let mut world = WorldState::new_except_empty();
let mut volumes = scan.split(' ');
let replaced = scan.replace("X", " ");
let mut volumes = replaced.split(' ');
let positional_scan = volumes.next();
for rune in positional_scan.unwrap().chars() {
match rune {
Expand Down
10 changes: 5 additions & 5 deletions src/mind.rs
Expand Up @@ -153,16 +153,16 @@ fn mmv_lva_heuristic(commit: &Commit) -> f32 {
}

fn order_movements_heuristically(commits: &mut Vec<Commit>) {
commits.sort_by(|a, b| {
commits.sort_unstable_by(|a, b| {
mmv_lva_heuristic(b)
.partial_cmp(&mmv_lva_heuristic(a))
.unwrap_or(Ordering::Equal)
});
}

fn order_movements_intuitively(experience: &HashMap<Patch, u32>,
commits: &mut Vec<Commit>) {
commits.sort_by(|a, b| {
fn order_movements_intuitively(
experience: &HashMap<Patch, u32>, commits: &mut Vec<Commit>) {
commits.sort_unstable_by(|a, b| {
let a_feels = experience.get(&a.patch);
let b_feels = experience.get(&b.patch);
b_feels.cmp(&a_feels)
Expand Down Expand Up @@ -380,7 +380,7 @@ pub fn potentially_timebound_kickoff(
debug!("waiting for {} of {} first-movement search threads",
time_radios.len(), premonitions.len())
}
forecasts.sort_by(|a, b| b.1.partial_cmp(&a.1).unwrap_or(Ordering::Equal));
forecasts.sort_unstable_by(|a, b| b.1.partial_cmp(&a.1).unwrap_or(Ordering::Equal));
Some(forecasts)
}

Expand Down

0 comments on commit 440738b

Please sign in to comment.