feat(minor): add a min match size

This commit is contained in:
Zixuan Chen 2023-07-14 11:09:07 +08:00
parent d8b51f6acf
commit e8ca8d61ed

View file

@ -97,9 +97,10 @@ impl CompactBytes {
}
let mut index = 0;
let min_match_size = 4.min(bytes.len());
while index < bytes.len() {
match self.lookup(&bytes[index..]) {
Some((pos, len)) if len >= 4 => {
Some((pos, len)) if len >= min_match_size => {
push_with_merge(&mut ans, pos..pos + len);
index += len;
}