Performance Benchmarks
The Blue Pill build now emits cycle-accurate benchmark data before the LCD demo
starts. The numbers below are recorded from the Renode model of STM32F103 while
running a ReleaseFast build (OPTIMIZE=ReleaseFast). They provide a baseline for
future optimisations and a regression guard for the fixed-point toolkit.
Cycle Counts
| Operation | Expected Range (cycles) |
|---|---|
| Fixed multiply | 2–6 |
| Sin lookup | 4–10 |
| Vec3 normalize | 50–100 |
| Mat4 multiply | 200–350 |
| Mat4 transform | 30–60 |
Use the validation task to confirm the latest firmware stays within these thresholds:
OPTIMIZE=ReleaseFast RENODE_NO_QUIT=1 mise run validate-bench
The command will boot Renode, capture the UART log, and assert each benchmark falls inside the expected range.
Binary Size Snapshot
$ arm-none-eabi-size zig-out/firmware/stm32f103_bluepill.elf
text data bss dec hex filename
Run the above after a ReleaseFast build to keep flash/RAM budgets under watch.
Notes
- Benchmarks rely on the Cortex-M3 DWT cycle counter. They automatically fall back to a host-friendly message when executed on non-Thumb architectures.
- The validation script accepts any UART log and can be used in CI to ensure optimisations do not regress.