madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.55k stars 2.42k forks source link

refactor contrib/puff.c to make the IO model explicit (getbyte/putbyte/recallbyte) #901

Closed patricksurry closed 7 months ago

patricksurry commented 8 months ago

fooling around with making a windowed version of puff.c where I can only see fixed sliding window of input, output and lookback. This is definitely slower but imho makes puff IO model easier to understand: input is only read sequentially byte by byte, output is only appended or looked-back at parameterized distance. All tests still pass.

madler commented 7 months ago

Thank you for your work and for submitting these changes, but I prefer to leave puff.c as is for simplicity.

patricksurry commented 7 months ago

No worries. On the odd chance anyone stumbles on it, I used as the basis for a streaming arduino implementation which can write eeprom images with input/output larger than the available ram. See https://github.com/patricksurry/eeprom-writer

Very cool to learn more about how zlib works, thanks for this minimal implementation!