From a20ffc8d13b568b04ee8bab6a90f241987077ed9 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Wed, 9 Aug 2023 10:20:52 +1000 Subject: hash part of the sequence to add locality --- dedumi.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dedumi.hs b/dedumi.hs index 31fd9fe..c529d1c 100644 --- a/dedumi.hs +++ b/dedumi.hs @@ -27,6 +27,9 @@ instance CuckooFilterHash ByteString where umiLength :: Int umiLength = 8 +extraHashBases :: Int +extraHashBases = 4 + trim :: ReadPair -> ReadPair trim x = x @@ -37,7 +40,7 @@ trim x = insert' :: (KnownNat b, KnownNat f) => CuckooFilter RealWorld b f ByteString -> ReadPair -> IO Bool insert' f x = - let y = B.take umiLength (x ^. _1 . nucs) <> B.take umiLength (x ^. _2 . nucs) + let y = B.take (umiLength + extraHashBases) (x ^. _1 . nucs) <> B.take (umiLength + extraHashBases) (x ^. _2 . nucs) in member f y >>= \case True -> pure True False -> -- cgit v1.2.3