Skip to content

Commit 98c215b

Browse files
committed
feat: improved binary matching speed by up to 30%
1 parent 21f134c commit 98c215b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bmatcher-core/src/matcher.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ impl<'a> BinaryMatcher<'a> {
4848
&self.pattern.byte_sequence()[seq_start as usize..seq_end as usize];
4949
let actual_bytes = self.target.subrange(data_cursor, expected_bytes.len())?;
5050

51-
if expected_bytes != actual_bytes {
51+
if expected_bytes
52+
.iter()
53+
.zip(actual_bytes.iter())
54+
.any(|(expected, data)| *expected != *data)
55+
{
5256
return None;
5357
}
5458

0 commit comments

Comments
 (0)