From d4882940aee492eb435f797bb2aee61a46f00e0a Mon Sep 17 00:00:00 2001 From: Luiz Irber Date: Sun, 10 Nov 2024 19:24:37 -0800 Subject: [PATCH] fix: Avoid re-calculating md5sum on clone and conversion to KmerMinHashBTree --- src/core/src/sketch/minhash.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/src/sketch/minhash.rs b/src/core/src/sketch/minhash.rs index 60b1c97c73..438294e098 100644 --- a/src/core/src/sketch/minhash.rs +++ b/src/core/src/sketch/minhash.rs @@ -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()), } } } @@ -1667,6 +1667,8 @@ impl From for KmerMinHash { new_mh.mins = mins; new_mh.abunds = abunds; + new_mh.md5sum = other.md5sum; + new_mh } } @@ -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()); + new_mh } } @@ -1714,6 +1718,8 @@ impl From for KmerMinHashBTree { new_mh.mins = mins; new_mh.abunds = abunds; + new_mh.md5sum = other.md5sum; + new_mh } }