image-rs / image-gif

GIF en- and decoder
Apache License 2.0
148 stars 42 forks source link

Move LZW decoder to a struct #151

Closed kornelski closed 10 months ago

kornelski commented 12 months ago

This makes state match a bit less busy. Additionally, it avoids reallocating decoder and its buffers when possible, which gives up to 3% speed improvement in benchmarks.

Separate lzw decoder will be handy later when I implement ability to return LZW-compressed frames, and then decode them in parallel https://github.com/image-rs/image-gif/pull/144#issuecomment-1492163801

kornelski commented 12 months ago

@HeroicKatora Are you okay with refactorings like that? Shall I continue with micro optimizations?