|
|
|
|
|
by bitbank
707 days ago
|
|
Over the years there have been many implementations of the deflate/inflate compression standard. I have been prioritizing speed for most of my projects and over the last few years have also been focused on getting things working on constrained/embedded devices. I set about profiling zlib and found some clever ways to speed it up and reduce its memory footprint. I'm mostly interested in the inflate side of the equation for decompressing gzip and PNG files. By removing the "I can work a byte at a time" feature and optimizing repeated patterns and unaligned accesses. My version runs 50-100% faster than both zlib and miniz on embedded processors (e.g. ESP32). It's down to a single C file of around 700 lines; 6.5K of RAM + the output data size. No external dependencies (not even malloc/file systems). My version forces you to use it as memory-to-memory. This can be quite useful for decoding small blocks of data on small devices (e.g. http requests). What do you think? |
|