Measures JsonFusion's code footprint for embedded ARM Cortex-M7 targets.
This benchmark compiles a realistic embedded configuration parser and measures the resulting binary size. The goal is to understand JsonFusion's flash memory requirements for resource-constrained embedded systems.
The test uses EmbeddedConfig - a realistic embedded configuration with:
- Fixed-size arrays (static allocation, no heap)
- Validation constraints (
range<>,min_items<>) - Nested structures (Network, Controller, Motor, Sensor, Logging)
- Optional fields (
std::optional) - ~2.5 KB data size (16 motors, 16 sensors, various strings)
This represents a typical embedded device configuration (motor controllers, IoT devices, industrial systems).
ARM Cortex-M7 (common in STM32H7, SAMV7, etc.):
- 32-bit ARM architecture
- Thumb-2 instruction set
- Hardware floating-point unit (FPv5-D16)
- Representative of modern embedded systems
Recommended: Use the Python build script (easier to maintain and extend):
./build.pyThis builds 2 configurations:
- size_optimized (
-Os -flto) - Minimize code size - aggressive_opt (
-O3 -flto) - Maximum speed
Each build outputs:
- Code size (
.textsection) - Flash memory usage - Const data (
.rodatasection) - Validation tables, literals - Initialized data (
.datasection) - Should be minimal - Uninitialized data (
.bsssection) - Global config (~2.5 KB) - Top symbols - Largest functions by size
To compare with alternatives:
Create minimal hand-written parser (no validation, error-prone).
- ArduinoJson
- jsmn (minimal tokenizer)
- cJSON
- yajl (event-driven / SAX parser)