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

Split decoding loop #34

Merged
merged 24 commits into from
Oct 18, 2024
Merged

Split decoding loop #34

merged 24 commits into from
Oct 18, 2024

Conversation

fintelia
Copy link
Contributor

This PR splits the main decoding loop into a "fast" loop that avoids most bounds checks, and a "careful" loop to handle the remaining input. The fast decoding loop also avoids redundant table lookups and generally does table lookups before refilling the bit buffer. These changes were inspired by the libdeflate library which uses a similar approach.

I measured a roughly 10% end-to-end speedup on PNG decoding from this change.

@fintelia fintelia merged commit f406b48 into image-rs:main Oct 18, 2024
10 checks passed
@fintelia fintelia deleted the fast-loop branch October 18, 2024 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant