Experimental evaluation of compression algorithms for memory-constrained embedded systems
TL;DR
Evaluating the suitability of several lossless compression algorithms for resource-constrained embedded platforms and how data representation influences compression performance demonstrates significant trade-offs between compression ratio, execution speed, and memory requirements in embedded environments.
Abstract
Embedded systems are constrained by limited flash memory, RAM (random access memory), and processing power, making efficient local data storage and transmission challenging. This study evaluates the suitability of several lossless compression algorithms for resource-constrained embedded platforms and assesses how data representation influences compression performance. LZW, Heatshrink, LZ4, FastLZ, and Miniz were evaluated directly on an STM32U575ZI microcontroller (Arm Cortex-M33, 160 MHz). A 104,067-byte sensor dataset comprising repetitive time-series measurements of soil and ambient temperature, humidity, battery voltage, timestamps, and identifiers was used as the test workload. The dataset was stored in three formats: CSV (comma-separated values) (104,067 bytes), binary (33,576 bytes), and bit-packed binary (26,581 bytes). Compression ratio, execution time, and total application RAM consumption, including input and output buffers, were measured. Miniz achieved the highest compression efficiency, reducing the 33,576-byte binary dataset to 11,352 bytes (33.81% of the original size). The fastest compression was obtained with LZ4 configured with acceleration = 16, which compressed the bit-packed representation in 9.437 ms and produced a 25,692-byte output. Among configurations selected for minimum compressed output, FastLZ achieved the shortest execution time at 31.653 ms. When total RAM consumption was evaluated consistently, including all required buffers, LZ4 operating on the bit-packed representation required the least memory among the minimum-output configurations, consuming 58,496 bytes. The results demonstrate significant trade-offs between compression ratio, execution speed, and memory requirements in embedded environments. Data representation substantially influences compression effectiveness, with binary and bit-packed formats generally improving efficiency over CSV. The findings provide practical guidance for selecting compression algorithms in resource-constrained embedded systems, where minimizing storage, execution time, or memory usage may be prioritized depending on application requirements.