Skip to content

Commit

Permalink
fix: Avoid re-calculating md5sum on clone and conversion to KmerMinHa…
Browse files Browse the repository at this point in the history
…shBTree
  • Loading branch information
luizirber committed Nov 11, 2024
1 parent e86c8a8 commit d488294
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/src/sketch/minhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ impl Clone for KmerMinHashBTree {
mins: self.mins.clone(),
abunds: self.abunds.clone(),
current_max: self.current_max,
md5sum: Mutex::new(Some(self.md5sum())),
md5sum: Mutex::new(self.md5sum.lock().unwrap().clone()),
}
}
}
Expand Down Expand Up @@ -1667,6 +1667,8 @@ impl From<KmerMinHashBTree> for KmerMinHash {
new_mh.mins = mins;
new_mh.abunds = abunds;

new_mh.md5sum = other.md5sum;

new_mh
}
}
Expand All @@ -1691,6 +1693,8 @@ impl From<&KmerMinHashBTree> for KmerMinHash {
new_mh.mins = mins;
new_mh.abunds = abunds;

new_mh.md5sum = Mutex::new(other.md5sum.lock().unwrap().clone());

Check warning on line 1696 in src/core/src/sketch/minhash.rs

View check run for this annotation

Codecov / codecov/patch

src/core/src/sketch/minhash.rs#L1696

Added line #L1696 was not covered by tests

new_mh
}
}
Expand All @@ -1714,6 +1718,8 @@ impl From<KmerMinHash> for KmerMinHashBTree {
new_mh.mins = mins;
new_mh.abunds = abunds;

new_mh.md5sum = other.md5sum;

new_mh
}
}
Expand Down

0 comments on commit d488294

Please sign in to comment.