AgriQL · Documentation · Benchmarks

Benchmarks on emulated boards

A field device records readings into the chip's own flash memory. The logger that does this is measured here on four emulated boards, from a small Cortex-M0 to a RISC-V chip of the ESP32-C3 class. The figures are what the emulator counted. They are not estimates.

These results come from the development build after 3.10.1. The field-device logger is not part of the 3.10.1 release. Nothing on this page has yet run on a physical board.

How it was measured

  • The same logging code that would run on a sensor node was compiled for each instruction set and run in QEMU 9.2.4.
  • QEMU ran in instruction-count mode, so every run counts exactly the same instructions. The figures do not vary between runs.
  • The RISC-V board reads its retired-instruction counter directly. The Cortex-M boards read a timer that a fixed calibration loop of two million instructions converts to instructions.
  • Per-reading figures are averages over the whole workload: 30,000 readings on the larger boards and 1,000 on the micro:bit. Boot recovery is one run, which is exact because the count does not vary.

Recording one reading

The common field case: three soil probes, one reading each per minute, values that change slowly. The logger chooses the smaller storage layout for each block of readings automatically.

Emulated boardCoreStands forInstructions per readingTime at reference clockFlash bytes per reading
micro:bit (nRF51)Cortex-M0STM32L0, RP2040 class, 32 MHz3,743117 µs16.44*
MPS2 AN385Cortex-M3STM32F1 class, 72 MHz1,46520.4 µs5.77
MPS2 AN386Cortex-M4STM32F4, nRF52 class, 168 MHz1,4838.8 µs5.77
RISC-V virtRV32IMACESP32-C3 class, 160 MHz1,4969.4 µs5.77

* The micro:bit has 16 KiB of RAM, so its test gives the log only 4 KiB of flash. Blocks of readings are shorter there, and block headers weigh more per reading.

Instructions to record one soil reading. Shorter is faster.
Cortex-M03,743
Cortex-M31,465
Cortex-M41,483
RV32IMAC1,496

At one reading a minute, 20 µs of work on a 72 MHz core is less than one millionth of each minute. The processor can sleep for the rest.

Reading back

The same soil log, read on the device. A scan reads every reading. A window query reads one sensor over the last tenth of the time range. Boot recovery is what the logger does after power returns: it finds the last complete block, here in 1 MiB of flash.

Emulated boardScan, per readingWindow query, per reading foundBoot recovery, 1 MiB
Cortex-M3 at 72 MHz319 instructions · 4.4 µs2,691 · 37 µs284,080 · 3.9 ms
Cortex-M4 at 168 MHz317 · 1.9 µs2,682 · 16 µs284,120 · 1.7 ms
RV32IMAC at 160 MHz354 · 2.2 µs3,560 · 22 µs270,593 · 1.7 ms

A checksum over stored data costs 8 instructions per byte on Cortex-M3 and M4, and 10 on Cortex-M0 and RISC-V.

Flash used per reading

Flash wears out with writing, and writing costs energy. So the number of bytes written for each reading matters as much as processor time. There are two storage layouts. The plain layout stores each reading in full. The compact layout stores how each reading differs from the one before it. The automatic setting picks whichever is smaller for each block.

WorkloadPlainCompactAutomaticInstructions per reading, plain → automatic (Cortex-M3)
Soil: three probes, slow values9.61 B5.77 B5.77 B894 → 1,465
Noisy: 24 sensors, random values, late timestamps10.59 B12.24 B10.59 B1,192 → 1,891
Flash bytes written per reading. Shorter writes less.

Soil

Plain9.61
Compact5.77
Automatic5.77

Noisy

Plain10.59
Compact12.24
Automatic10.59

Bytes include block headers. The same byte counts were measured on Cortex-M3, Cortex-M4, and RISC-V.

On a soil log, the automatic setting writes 40% less flash than the plain layout. It costs about 570 more instructions per reading. On the noisy workload, the compact layout would have been larger than the plain one. That is why the choice is made block by block, and not once for the whole device.

What these figures do not include

  • Flash timing and energy. The emulator does not model the time or current needed to program and erase flash. The tests report bytes written and erases instead. Times and energy are added only from a board's datasheet, and none has been added yet.
  • Real clock cycles. Time here is instructions divided by clock rate. A real core needs one or more cycles for each instruction, plus flash wait states. So each time is a lower bound.
  • Caches and radio. Neither is modelled.
  • Other boards. The Renode models of STM32F4 and STM32L0 boards are prepared, but were not run.
  • Other databases. No other embedded store was run under the same emulator and workload. So there is no head-to-head comparison here, and none is implied.

Measuring on physical boards, with flash timing and current, is the next step. When those numbers exist, they will be added to this page next to these.

How AgriQL differs from other databases.