image-rs / image-gif

GIF en- and decoder
Apache License 2.0
150 stars 40 forks source link

Move LZW decoder to a struct #151

Closed kornelski closed 1 year ago

kornelski commented 1 year 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 1 year ago

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