Originally published on Maker.io (DigiKey).

Full summary chart of all printf speed optimizations across all three articles

The bottleneck at the end of Part 2 was no longer the UART or the processor — it was the text formatting. A “Value of counter: %03d\n” message is 22 characters; a binary-serialized equivalent can fit in 7 bytes. Part 3 benchmarks three serialization libraries over a buffered USB connection: MessagePack (38.9k msg/sec, 26.9 kB flash), FlatBuffers (~36k msg/sec at 75.9% CPU utilization, 18.1 kB flash), and bitproto (117.8k msg/sec, 16.6 kB flash). A hand-rolled minimal sprintf lands at 14.2k msg/sec with just 4.3 kB of flash.

The full three-article summary chart puts it all in context: 142 msg/sec at the original baseline versus up to 117.8k msg/sec with bitproto. The primary tradeoff at the binary serialization tier is portability and human readability — you’ll need a deserializer on the host and your logs won’t be grep-friendly.

Read the full article →