This is a benchmark comparison of several Protocol Buffers implementations that are suitable for use on embedded devices. The measured metrics are execution speed, RAM usage and compiled code size. Tested platforms are currently 32-bit ARM Cortex-M3 and 8-bit Atmel ATmega128.
The benchmarks are implemented as a simple test program that decodes a 574-byte "AllTypes" message and encodes a success result into a small result message. The input message is designed so that it contains all the types defined in the Protocol Buffers standard, including repeated fields and submessages. Because the input message is much larger than the output message, the benchmark will give more weight to decoding speed than to encoding speed. Depending on application this may or may not be desirable.
All the benchmarks are executed in simulators. The ARM Cortex-M3 simulator is only instruction-level accurate, which means that time taken by e.g. branch delays and division operations is not taken into account. To get exact results for your platform and application, you should construct a benchmark using specific message types and processor you are going to use.
The tests were compiled using the following compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.4 20130613 (release) [ARM/embedded-4_7-branch revision 200083]
The tests have been executed using the following simulator: QEMU emulator version 1.1.2 (Debian 1.1.2+dfsg-6a), Copyright (c) 2003-2008 Fabrice Bellard
The tests were compiled using the following compiler: avr-gcc (GCC) 4.7.2
The tests have been executed using the following simulator: SimulAVR 1.1dev
The entire source code and scripts used for these benchmarks is available at GitHub.
Originally written by Petteri Aimonen <jpa@npb.mail.kapsi.fi>