Skip to content

Commit

Permalink
more optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
H-A-M-G-E-R committed Apr 3, 2024
1 parent eecc3f9 commit 00be7c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions miratope-core/src/conc/faceting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ impl Ranks {
for el in &self[rank] {
all_subs.push(el.subs.clone());
}
let mut sorted = all_subs.clone();
sorted.sort_unstable();
let mut sorted: Vec<(usize, &Subelements)> = all_subs.iter().enumerate().collect();
sorted.sort_unstable_by(|a, b| a.1.cmp(b.1));

let mut perm = Vec::new();
for i in &all_subs {
perm.push(sorted.iter().position(|x| x == i).unwrap());
let mut perm = vec![0; all_subs.len()];
for i in 0..all_subs.len() {
perm[sorted[i].0] = i;
}

for i in 0..self[rank].len() {
self[rank][i].subs = sorted[i].clone();
self[rank][i].subs = sorted[i].1.clone();
self[rank][i].subs.sort_unstable();
}

Expand Down

0 comments on commit 00be7c7

Please sign in to comment.