Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallelize the checking of the first two bytes of a potential match. #259

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion zlib-rs/src/deflate/algorithm/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ pub fn deflate_quick(stream: &mut DeflateStream, flush: DeflateFlush) -> BlockSt
let str_start = &state.window.filled()[state.strstart..];
let match_start = &state.window.filled()[hash_head as usize..];

if str_start[0] == match_start[0] && str_start[1] == match_start[1] {
macro_rules! first_two_bytes {
($slice:expr, $offset:expr) => {
$slice[$offset] as u16 | ($slice[$offset + 1] as u16) << 8
}
}
if first_two_bytes!(str_start, 0) == first_two_bytes!(match_start, 0) {
let mut match_len = crate::deflate::compare256::compare256_slice(
&str_start[2..],
&match_start[2..],
Expand Down
Loading