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

Wasted cycles rebuilding decoding tables for static huffman blocks #37

Closed
fintelia opened this issue Nov 28, 2024 · 1 comment
Closed

Comments

@fintelia
Copy link
Contributor

So far I've assumed that PNGs rarely use static huffman blocks because the symbol distribution is very different from other sorts of compressed data. As a result, there has been very little effort to make handling of static blocks fast. The most significant overhead is that table building is repeated every time a static block is encountered.

At a minimum, table building should be skipped for empty static huffman blocks (which don't make a ton of sense in a PNG, but are produced by certain kinds of zlib flush operations). Further improvements could be made by reusing decoding tables between consecutive static huffman blocks or even building the tables once and then caching them in a static variable.

@Shnatsel
Copy link
Contributor

Shnatsel commented Dec 1, 2024

Is this fixed by #39 ?

@fintelia fintelia closed this as completed Dec 1, 2024
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

No branches or pull requests

2 participants