Heatshrink: Data compression library for embedded/real-time systems
github.com
github.com
ESP32 port: https://github.com/ESP32-Musings/esp32_compressed_delta_ota_...
detools: https://github.com/eerimoq/detools
Also very simple to understand and port and play around with, and to compare with other algorithms. More or less took this project as an excuse to learn some compression basics. Can recommend
Really just curious :)
When working with embedded devices like that, the main thing is you can't just easily import libraries or use many layers of abstraction (limited stack depth too). So generally everything is done at a low level.
While technically the customer asked for the solution to problem A, they wanted us to solve problem B, but we failed to invoke our inner patio11, and as a result delivered what they said instead of what they meant. A frustrating lesson for me. At that point in my career I should have known better already.
ETA: sibling comment about Cortex-M0 is spot on. You really start counting bytes. Some kiB of RAM sound a lot, but when you have to juggle several tasks, and don't have to option to write from scratch but instead reuse existing old code you've lying around, stuff gets dirty pretty quickly. Other team member was doing the hard work, I was just providing tooling for them.
Another related algorithm is LZJB, which I've successfully used in embedded environments in production. I have a pure Python implementation [1] that can be useful for "offline" tool development, i.e. when building images for consumption by some embedded target, just thought I'd mention that.
https://spin.atomicobject.com/2013/03/14/heatshrink-embedded...
HS 13,4 LZO1X-1(11) sample
54.90% 38.02% alice29.txt
50.51% 34.00% asyoulik.txt
57.63% 49.38% cp.html
64.68% 56.97% fields.c
56.87% 51.03% grammar.lsp
71.65% 64.12% kennedy.xls
56.53% 40.33% lcet10.txt
48.57% 29.41% plrabn12.txt
77.74% 82.91% ptt5
47.76% 40.64% xargs.1
64.10% 54.90% total (note: doesn't include `sum`)
It does seem to have a good compression compared with LZO1X. I think this is mostly because LZO1X has a requirement that literals should be aligned at byte boundary for the performance but Heatshrink doesn't.[1] https://spin.atomicobject.com/2013/03/14/heatshrink-embedded...
Haha! :-)