Benchmark methodology¶
The point of these benchmarks is to find out where MicroGoose does well, where it falls short and how far it can be pushed. They are not meant to show that it is fast. Every result is published, losses included, and every claim should be checkable by someone trying to prove it wrong. That person needs the source, the exact build, the raw output and the arithmetic, and all four are in this repository.
The phases¶
- Baseline. MicroGoose as it was before any performance work, preserved
as the git tag
perf-baseline(cda583a). The suite and the native C reference are measured against it, on every board. - Correctness. Leaks, races, deadlocks and resource reclamation are investigated apart from performance. A fix that changes a number is reported with the number before and after.
- Performance engineering. Profile, then change one subsystem at a
time and rerun the full suite after each change, together with the
conformance tests (
tests/conformance.py) and the stress tests. Each change's measured effect is reported, regressions included, in Optimizations. - Other languages. Rust, TinyGo and MicroPython run the same workloads on the same boards: Rust, TinyGo and MicroPython.
Results holds the tables. Findings holds what they mean and the opportunities they point to. The report puts the baseline, the latest runs and the other implementations side by side.
Boards¶
| ESP32-S3 | ESP32 (WROOM-32) | ESP32 (WROVER-E) | STM32H743 | Raspberry Pi Pico 2 W | |
|---|---|---|---|---|---|
| Board | N16R8 module, CH343 USB-UART | WROOM-32 module, CP210x USB-UART | WROVER-E module (ESP32-D0WD-V3, 4 MB flash), CH340 USB-UART | DevEBox H743VITX, ST-Link | Pico 2 W (RP2350A), its own USB |
| Core | 2 × Xtensa LX7, 240 MHz | 2 × Xtensa LX6, 240 MHz | 2 × Xtensa LX6, 240 MHz | Cortex-M7, 400 MHz from HSI | 2 × Cortex-M33, 150 MHz; the suite runs on one |
| FPU | single precision | single precision | single precision | double precision (see below) | single precision; f64 through the Pico SDK's routines on the chip's double coprocessor |
| RAM | 512 KB + 8 MB octal PSRAM | 520 KB, no PSRAM | 520 KB + 8 MB quad PSRAM, 4 MB of it mapped | 1 MB, with 128 KB DTCM | 520 KB, no PSRAM |
| RTOS | ESP-IDF 6.1 FreeRTOS (SMP) | ESP-IDF 6.1 FreeRTOS (SMP) | ESP-IDF 6.1 FreeRTOS (SMP) | FreeRTOS 10.3.1 from STM32Cube | FreeRTOS 11.3.3 (Raspberry Pi's RP2350 port), Pico SDK 2.3.1 |
| Compiler | GCC 15.2 (esp-15.2.0_20251204) | GCC 15.2 (esp-15.2.0_20251204) | GCC 15.2 (esp-15.2.0_20251204) | GCC 7.2.1 (arm-none-eabi) | GCC 14.2.1 (Arm GNU Toolchain 14.2.Rel1) |
| Console | UART at 115200 | UART at 115200 | UART at 115200 | SEGGER RTT over ST-Link | USB serial, the Pico SDK's |
Each run's env.json records the compiler strings found in the ELF, the
version of every PlatformIO package, the build log and the build
configuration. The configuration includes the generated sdkconfig on the
ESP32s and FreeRTOSConfig.h on the H7 and the Pico 2 W.
The Pico 2 W and the WROVER-E joined after the optimizations. They have runs of MicroGoose and C only: no baseline and no other language. The WROVER-E runs the WROOM-32's images. C's ESP32 image has MicroGoose's PSRAM settings, so on the WROVER-E both add its PSRAM to the heap.
Implementations¶
All implementations follow the same rules:
- Same algorithm, same parameters, same data widths. Data is
u8,i32,u32,f32orf64in every language. Loop counters and indexes follow each language's own habit:i64in Goose,intin C. That's a real cost of the language's defaults on a 32-bit core, so it is measured, not hidden. - The same checked result. Every workload prints a check value: a CRC, a hash of the sorted array or an iteration count. The report flags any implementation whose result differs from C's, and any boot whose result differs from another boot's.
-
The same chip setup. C uses MicroGoose's settings:
- the clocks and the cache setup;
- the RTOS and its configuration;
- the console;
- the optimization level;
- the task priorities and the stack sizes.
The H7's C startup code copies the port's.
-
Written the way someone fluent in the language would write it. That means no deliberate pessimization, and no tuning a real program wouldn't get either.
Goose (bench/goose/bench.goose)¶
This is the MicroGoose pipeline as users run it (mg build). The program
is compiled to C at -O2 with the port's flags. On every target those
include -fno-tree-sra -fno-ipa-sra, a workaround for an Xtensa GCC
miscompile (see Findings). The suite runs with the
default 16 KB data-stack reservation unless a run's label says otherwise.
One does: the WROOM's worker-reserve-4k run is built with
--worker-reserve 4K, which gives each worker's data stack 4 KB. As
built, that board has no room for scale_4w's four workers
(Optimizations, section 9).
The S3's results are the same either way. The WROVER-E's
wrover-worker-reserve-4k run is built the same way. Its runs stopped at
scale_4w either way, where a worker's task couldn't be created, until
Optimizations, section 16.
C (bench/c/)¶
bench.c holds the workloads. It runs on FreeRTOS tasks and queues on every
board. esp/, h7/ and rp2350/ are its PlatformIO projects:
esp/is an ESP-IDF project with the settings from MicroGoose'sfirmware/sdkconfig.defaultsthat change how code runs. These include the 240 MHz clock,-O2(COMPILER_OPTIMIZATION_PERF), a 1 kHz tick, the UART console and PSRAM.h7/uses the STM32Cube framework with MicroGoose's FreeRTOS kernel, its build script and itsFreeRTOSConfig.h.-O2applies to the program, and the HAL builds at PlatformIO's default, as in MicroGoose.rp2350/uses the Pico SDK and FreeRTOS from the platform MicroGoose's port uses, pinned to the same commit, with its heap (heap_3, on newlib'smalloc), itsFreeRTOSConfig.hand the defines it builds the SDK with.-O2applies to the program, and the SDK builds at PlatformIO's default, as in MicroGoose. The watchdog is fed from the tick, as MicroGoose's is.
The C reference differs from Goose in these ways:
| Goose | C | |
|---|---|---|
| Main program | task pinned to core 1, priority 5, 24 KB stack (ESP32s); priority 1 on the DTCM stack (H7); priority 1, 16 KB stack (Pico 2 W) | the same |
| Worker | pthread: priority 5, no core affinity, 16 KB stack (ESP32s); FreeRTOS task, priority 1, 16 KB (H7 and Pico 2 W). Beside that stack, one data stack of 16 KB (4 KB in the WROOM-32's and WROVER-E's worker-reserve-4k runs), which no worker of the suite writes to |
FreeRTOS task, the same priority, affinity and stack |
| Ending a worker | thread_wait. On the ESP32s with PSRAM a finished worker's thread is joined as it ends, by a task above the program's priorities, which frees its stack (Optimizations, section 16); with PSRAM, up to two finished threads first wait a second for the next spawn (section 15) |
the joiner deletes the finished task (FreeRTOS frees a self-deleted task only when the idle task runs) |
| Queue | Goose typed queue: unbounded, a put never waits | FreeRTOS queue deep enough (2000) that a put never waits |
| Periodic timer | timer_every (ESP32s: a hardware timer's interrupt since Optimizations, section 8; at the baseline esp_timer, whose callbacks run in a task, so a tick was stamped 10 to 11 µs after it was due; H7: TIM5 interrupt; Pico 2 W: a repeating alarm in the Pico SDK's alarm pool) |
ESP32s: GPTimer interrupt; H7: TIM5 interrupt at the same priority; Pico 2 W: the same repeating alarm |
| Pin edges | pwm_start puts a 997 Hz wave on a pin and pin_watch takes its rising edges: GPIO4 through LEDC and the GPIO interrupt service on the ESP32s, PB0 through TIM3 and EXTI0 on the H7, GPIO4 through PWM slice 2 and the GPIO bank's interrupt on the Pico 2 W. The interrupt stamps the edge and queues it for event_wait |
the same pin, wave and interrupt: LEDC with gpio_isr_handler_add on the ESP32s, TIM3 and EXTI0 at priority 3 on the H7, PWM slice 2 with a raw handler on IO_IRQ_BANK0 on the Pico 2 W. The interrupt stamps the edge and sends it to a FreeRTOS queue |
| Contained faults | thread_spawn_contained |
none: C can't contain a task's fault without ending the program, so the benchmark doesn't exist for C |
A float x * y + z |
rounded after the multiply and again after the add: the generated C is compiled under #pragma GCC optimize("fp-contract=off") |
GCC's default, -ffp-contract=fast: one rounding where the chip has a fused multiply-add. matmul_f32 and mandel_f32 use madd.s on the ESP32s and vfma.f32 in c-fpu, and mandel_f64 uses vfma.f64 in c-fpu (Optimizations, section 6) |
The H7 C project has a second environment, h743_fpu. It is the same
code built for the hardware double-precision FPU (-mfpu=fpv5-d16
-mfloat-abi=hard). At perf-baseline, MicroGoose's H7 build used
software floating point, like PlatformIO's default for the board, and the
c-fpu column showed what that cost. Since the
first optimization it uses the FPU too,
so c-fpu is the C to compare it with.
Rust (bench/rust/)¶
The Rust suite is written the way most embedded Rust is written today:
no_std, on Embassy's async executor, with no
RTOS underneath.
- Shared code.
common/holds the workloads and the whole suite (suite.rs), so every board runs the same Rust. h7/. It usesembassy-stm32on one executor. The chip is set up as the C reference sets it up: the clock, the caches, the DTCM stack, RTT at the same address and TIM5 at interrupt priority 3.esp/. It usesesp-halwithesp-rtos, running one Embassy executor on each core, at 240 MHz.- Toolchains.
rustc1.100.1 for the H7, and espup's Xtensa build of Rust 1.97 for the ESP32s. Each crate's version is pinned inCargo.lock, and the run'senv.jsonlists them. - Profile. Cargo's release profile:
opt-level = 3, with fat LTO and one codegen unit, as embedded projects usually set it.
The rest differs from C as Rust's habits differ:
| C | Rust | |
|---|---|---|
| Worker | FreeRTOS task, preempted at the end of a 1 ms slice | Embassy task: cooperative, runs until it awaits |
| Where workers run | no core affinity (ESP32s) | the program's own executor on core 0. In scale_*, worker j runs on core j % 2 (ESP32s) |
| Queue | FreeRTOS queue | embassy-sync channel with the same capacity |
| Ending a worker | the joiner deletes the task | the task signals, and its slot in a static pool is reused |
Busy worker in timer_busy |
preempted | yields every 4,096 iterations, where it checks whether to stop, as the C worker checks its queue |
| Floating point on the H7 | software (c) or hardware (c-fpu) |
hardware: Rust's default for thumbv7em-none-eabihf |
| Array access | unchecked | bounds-checked, unless the compiler proves an index in range |
| Main program | core 1 (ESP32s) | core 0 (ESP32s), where esp-rtos starts it |
| Heap | malloc |
none: everything is static, so there is no @heap line |
The timed inputs go through core::hint::black_box, which tells the
compiler nothing about them. Without it, LLVM computed mandel_f64 once
for all 15 repetitions, because its inputs are constants. GCC didn't do
that for the C build, whose inputs are globals.
Building:
- cargo.
bench/run.py --impl rustruns cargo. On Windows with Smart App Control on, the policy won't run the build scripts cargo compiles, soBENCH_CARGO=wsl:<distro>runs cargo in WSL instead. - ESP32 flash image.
espflash save-image --mergewrites it, and PlatformIO'sesptoolflashes it.
TinyGo (bench/tinygo/)¶
The Go suite is written the way Go is written: workers are goroutines,
queues are buffered channels and a worker's end is a sync.WaitGroup. It
is one program for every board. Each board's part is in board_*.go: its
console, its cycle counter and its timer interrupt.
- Toolchain. TinyGo 0.44.0 (LLVM 22.1.4) with Go 1.27.4, at
-opt=2. That is TinyGo's setting for speed; its default,-opt=z, is for size. Everything else is TinyGo's default for the target, including its garbage collector and its scheduler. - Targets.
esp32-generic(WROOM),esp32s3-genericwith-serial=uart(the S3's CH343 is on UART0), and, on the H7, a target of our own. - The H7 target. TinyGo supports the STM32H7 but has no board file for
the DevEBox, whose crystal is 25 MHz.
h7/devebox-h743.jsonbuilds for thestm32h743withh7/board_devebox_h743.go, whichrun.pyadds to the machine package of a TinyGo tree it makes inbuild/tinygo-root. The rest of that tree links to the installed TinyGo. tinygo-cores. The same suite on the S3 with-scheduler=cores, TinyGo's multicore scheduler, which isn't its default.
The rest differs from C as TinyGo's defaults differ:
| C | TinyGo | |
|---|---|---|
| Clock | 240 MHz (ESP32s), 400 MHz from HSI (H7) | the runtime sets it: 160 MHz on the WROOM, 240 MHz on the S3, 400 MHz from the HSE crystal on the H7 |
| Cores used | both (ESP32s) | one. TinyGo's default scheduler runs every goroutine on core 0. tinygo-cores uses both cores of the S3 |
| Worker | FreeRTOS task, preempted at the end of a 1 ms slice | goroutine: cooperative, runs until it blocks or yields, its stack allocated from the heap |
| Queue | FreeRTOS queue | buffered channel with the same capacity |
| Ending a worker | the joiner deletes the task | sync.WaitGroup |
Busy worker in timer_busy |
preempted | calls runtime.Gosched() every 4,096 iterations, where it checks whether to stop, as the C worker checks its queue |
| Periodic timer | ESP32s: GPTimer interrupt; H7: TIM5 interrupt | the same timers: TIMG1 on the ESP32s (a level-1 interrupt), and TIM5 on the H7 through TinyGo's timer API, at priority 3. The interrupt sends the tick's time on a channel with a non-blocking select |
| Floating point on the H7 | software (c) or hardware (c-fpu) |
software: TinyGo's cortex-m7 target is +soft-float |
| Array access | unchecked | bounds-checked, unless the compiler proves an index in range |
| Main program | core 1 (ESP32s) | core 0 |
| Memory | malloc |
a garbage-collected heap. @heap is the free heap after a collection |
| Code location (ESP32s) | flash, through the cache | the same. TinyGo's image takes the place of ESP-IDF's bootloader |
The timed inputs that are constants (the Mandelbrot sizes) are read with
volatile loads, so the compiler can't compute a result once for all 15
repetitions. That is the role black_box plays in the Rust build.
Building:
- TinyGo and Go.
bench/run.py --impl tinygofinds them onPATH, or in the bin directories named byBENCH_TINYGOandBENCH_GO. They run on Windows as they are, with no WSL. - ESP32 flash image. TinyGo writes it, and PlatformIO's
esptoolflashes it where the ROM loads a bootloader from: 0x1000 on the WROOM, 0x0 on the S3. - RTT on the H7. TinyGo's RTT control block is an ordinary global, so
run.pyreads its address from the ELF's_SEGGER_RTTsymbol and has OpenOCD look there. TinyGo's RTT drops what doesn't fit in its 1 KB buffer, so the board'swritewaits for room while the debugger is reading.
MicroPython (bench/micropython/)¶
The MicroPython suite is written the way MicroPython is written: plain
Python, with asyncio for concurrency. It is one file, bench.py, for
every board.
- The firmware. MicroPython 1.29.0, built from the release's source
for each board, with
bench.pyfrozen in asmain.py, so it runs at boot. Everything else is MicroPython's default build for the board. The benchmark adds no C code. - Boards.
- S3:
ESP32_GENERIC_S3with theSPIRAM_OCTvariant, the firmware MicroPython offers for an N16R8 module. - WROOM:
ESP32_GENERIC. - H7: a board of our own,
boards/DEVEBOX_H743, because MicroPython has none for the DevEBox. It is MicroPython'sVCC_GND_H743VIboard, the same chip with a 25 MHz crystal too, set to 400 MHz with 2 flash wait states as the C reference is. It has no USB and no internal-flash filesystem.
- S3:
- ESP-IDF. 5.5.2, the version MicroPython 1.29 recommends. It isn't the 6.1 that C and Goose use: MicroPython 1.29 supports 5.3 to 5.5.4.
- The H7 console. MicroPython's stm32 port has no RTT.
rtt.pywrites a SEGGER RTT control block from Python at the start of DTCM, where the C and Rust builds put theirs, and attaches it to the REPL withos.dupterm, soprint()goes there. DTCM isn't cached, so the debugger sees every write. It is free because the board has no internal-flash filesystem: MicroPython's H743 builds use DTCM as that filesystem's cache. micropython-native. The same suite with@micropython.nativeon the timed compute functions (the# @nativelines inbench.py). It compiles them to machine code instead of bytecode. It is one decorator per function, MicroPython's documented first step for hot code, so it is a variant and not a rewrite.@micropython.viper, which needs type annotations and changes integer semantics, isn't measured.
The rest differs from C as MicroPython's defaults differ:
| C | MicroPython | |
|---|---|---|
| Execution | compiled at -O2 |
bytecode, interpreted (micropython), or native code for the compute functions (micropython-native) |
| Clock | 240 MHz (ESP32s), 400 MHz (H7) | the board's default: 160 MHz on the WROOM (ESP32_GENERIC), 240 MHz on the S3, 400 MHz on the H7 |
| Cores used | both (ESP32s) | one: asyncio runs every task on the interpreter's own thread, which MicroPython pins to core 1 on the ESP32s |
| Worker | FreeRTOS task, preempted at the end of a 1 ms slice | asyncio task: cooperative, runs until it awaits |
| Queue | FreeRTOS queue | a 30-line bounded queue on two asyncio.Events in bench.py, with the same capacity: MicroPython's asyncio has no queue |
| Ending a worker | the joiner deletes the task | await on the task |
Busy worker in timer_busy |
preempted | await asyncio.sleep_ms(0) every 4,096 iterations, where it checks whether to stop, as the C worker checks its queue |
| Periodic timer | ESP32s: GPTimer interrupt; H7: TIM5 interrupt | the ports' timer APIs. ESP32s: machine.Timer(2), timer group 1's timer 0, the one C uses. Its callback is always soft: it runs when the interpreter next checks for pending callbacks (MicroPython has no hard timer callbacks there). H7: pyb.Timer(5), a hard interrupt at MicroPython's TIM5 priority. The callback stamps the tick and sets an asyncio.ThreadSafeFlag |
| Integers | int32_t, uint32_t |
Python integers: small ones are tagged, those of 2^30 and over are heap-allocated big integers. CRC values and half the sort's values are that large |
| Floating point | f32 and f64 as written |
one float type, heap-allocated: single precision on the ESP32s and double on the H7 (@meta float_bits). mandel_f64 and mandel_f32 run the same code in that type, and the arrays are array('i') and array('f') |
| Floating point on the H7 | software (c) or hardware (c-fpu) |
hardware: MicroPython's H743 builds use the double-precision FPU (FPv5-D16 in the ELF's attributes), so c-fpu is the fair comparison there |
| Memory | malloc |
MicroPython's garbage-collected heap, in PSRAM on the S3 (the SPIRAM_OCT build puts it there). @heap is the free heap after gc.collect() |
| Code location | flash, through the cache (ESP32s) | the interpreter and the frozen bytecode in flash, through the cache on the ESP32s |
The timer's stamp on the ESP32s is when the soft callback ran, not when
the interrupt came. So timer_*_wake there leaves out the time from the
interrupt to the callback, which on the H7 is part of the measurement.
There is no optimizing compiler that could compute a result once for all
15 repetitions, so the inputs need no black_box.
Building:
- In WSL or Linux.
bench/run.py --impl micropythonbuilds in a POSIX shell:BENCH_MICROPYTHON=wsl:<distro>runs it in WSL. It clones MicroPython atv1.29.0and ESP-IDF atv5.5.2into~/mpywhen they aren't there, and refuses a tree at another version. The H7 builds with Ubuntu 24.04'sgcc-arm-none-eabi(GCC 13.2). - What it keeps.
build/micropython/<impl>-<target>/holds what was frozen (main.py,rtt.py) with the manifest, and the ESP32s' generatedsdkconfig. The run keeps them in itsconfig/. - Flashing. The ESP32s'
firmware.binstarts with the bootloader, so PlatformIO'sesptoolwrites it at 0x1000 (WROOM) or 0x0 (S3). OpenOCD programs the H7's ELF.
Benchmarks¶
Every benchmark runs 2 warm-up repetitions, which aren't reported, then 15 reported ones. Where the benchmark times individual events, it reports every event.
| Benchmark | What is timed | Parameters | Check |
|---|---|---|---|
clock_1000 |
1000 reads of the clock every other benchmark uses (micros() / bp_now_us()) |
— | 1000 |
crc32 |
bitwise CRC-32 (IEEE, reflected, no table) of a buffer | 16384 bytes from glibc's LCG | the CRC |
heapsort |
heapsort of 32-bit integers (refilled before each repetition, not timed) | 2048 values from the LCG | a hash of the sorted array, 0 if unsorted |
mandel_f64 |
Mandelbrot iteration counts, f64 |
48 × 32 grid, 128 iterations | total iterations |
mandel_f32 |
the same in f32 |
the same | total iterations |
matmul_f32 |
32 × 32 matrix product, f32 |
entries are small multiples of 1/4 and 1/2, so every sum is exact and fused multiply-adds can't change it | 4 × the sum of the product |
queue_2000 |
2000 messages of two i64 from a worker to main, from the go message to the last one taken |
the worker is spawned and reports ready before timing starts | the sum of the payloads |
pingpong |
each round trip main → worker → main through two queues | 1000 rounds after 20 warm-up rounds | rounds completed |
spawn_wait |
spawning a worker that does nothing and waiting for it | 50 | spawns completed |
scale_main |
mandel_f64 at 64 × 48, 256 iterations, on main |
— | total iterations |
scale_Kw |
the same work split over K workers by interleaved rows, from before the first spawn to after the last wait | K = 1, 2, 4 | total iterations |
timer_idle_gap, timer_idle_wake |
a 1 ms periodic timer: the time between ticks' timestamps, and the time from a tick's timestamp to the program having it | 1000 ticks after 10 | ticks missed |
timer_busy_gap, timer_busy_wake |
the same, with a worker spinning at the same priority | the same | ticks missed |
pin_idle_gap, pin_idle_wake (Goose and C) |
a pin's rising edges, from a 997 Hz wave the pin itself puts out: the time between edges' timestamps, and the time from an edge's timestamp to the program having it. No wire is needed, and no task makes the edges. The period, 1,003 µs, doesn't divide the scheduler's 1 ms tick, so the edges fall everywhere in it | 1000 edges after 10 | edges missed |
pin_busy_gap, pin_busy_wake (Goose and C) |
the same, with a worker spinning at the same priority | the same | edges missed |
fault_contained (Goose) |
spawning a contained worker that makes an out-of-bounds write, and the supervisor's thread_wait returning false with the message |
20 | faults caught |
After each benchmark, the suite prints the free heap. After the faults it
also prints the change in free heap they caused (@meta
fault_heap_delta), which catches a leak per fault.
The pin benchmarks need the pin to themselves. On the bench these runs
were made on, the two ESP32 boards' GPIO4 pins are connected. The WROOM's
first Goose run of the pins group
(20261204T194119Z-esp32-goose-4746101-pins) was made while the S3,
which had just finished the same group, still held its pin low: some
edges came as little as 6 to 29 µs after the one before. The run in the
tables was made with the S3's pin left as an input, and its edges are
1,000 to 1,006 µs apart. Both runs are in bench/results/, and their wake times
agree: a median of 12 µs and a slowest of 19 or 20.
Measurement¶
-
The clock. Every time comes from
micros()(Goose) orbp_now_us()(C), at 1 µs resolution:- On the ESP32s both read
esp_timer_get_time(). - On the H7 both read the DWT cycle counter. C extends it to 64 bits
and divides. At the baseline Goose's
micros()did the same throughclock_gettime(). Since Optimizations, section 7 the port keeps the time as seconds, microseconds and cycles, and a read makes one 32-bit division. - On the Pico 2 W both read the Pico SDK's 1 MHz timer
(
time_us_64()).
clock_1000measures what a read costs, and every other result includes two reads. - On the ESP32s both read
-
Repetitions and boots.
bench/run.pybuilds and flashes once, then resets the board--bootstimes (5 for the published runs). Each boot runs the whole suite. The report pools every sample from every boot, and also gives each boot's median, so differences between boots show up separately from differences within one. - Statistics (
bench/stats.py, plain Python):- Percentiles are nearest-rank, so every reported minimum, percentile and maximum is a value the board printed.
- The 95% confidence interval of the median is a percentile bootstrap
with a fixed seed, so recomputing it from
samples.jsongives the same interval. summary.jsonalso has the mean, the standard deviation and the coefficient of variation.
- Code placement matters. On the H7, the C
crc32went from 2171 µs to 2425 µs when unrelated code changed elsewhere in the image. That's a 12% swing from layout alone: flash wait states, instruction-cache alignment and the branch predictor. A difference of that size between two builds isn't evidence on its own. Each claim in the findings says how large a margin it rests on.
Lost console bytes¶
The host can lose bytes of a boot's console, and a sample line then arrives
cut, or not at all. The console doesn't say how many samples are coming, so
bench/run.py holds each benchmark's count (15, 1000, 50 or 20: the table
under Benchmarks) and checks every boot against it:
- A sample line counts only if it names one of the suite's benchmarks, has
the unit
usand holds 1 to 20 integers. Any other is reported with its line number and gives no samples, so a cut line never becomes a benchmark of its own. - A benchmark with samples needs its check line.
- A benchmark must have as many samples as the suite prints. A timer or a pin may be short by the events its check says it missed, since a missed event has no sample.
A boot that fails any of these is printed as DAMAGED with what was found.
samples.json keeps the findings under damage, the run exits with an
error, and the report's "complete" column says no. What a damaged boot
did deliver stays in samples.json, so repeat the run rather than use it.
The check can't see a loss that leaves whole lines and the right counts,
such as one digit gone from inside a value, or a benchmark that left no
line at all, its check included. Runs stored before this check have no
damage entry.
Reproducing a run¶
You need a board, the repository at the run's revision (in env.json) and
PlatformIO. Then:
python bench/run.py --target s3 --impl goose --boots 5
python bench/run.py --target s3 --impl c --boots 5
python bench/report.py
Set MG_PORT to the board's serial port when several are attached. The
WROVER-E is --target esp32 with --label wrover, or wrover- and a
name for a variant: that label is how the report tells its runs from the
WROOM-32's. The H7 needs an ST-Link. The Pico 2 W is flashed over its own USB, with
picotool, and restarted with it for each boot. To check a published number without a board:
- Open the run's
samples.json, or itsboot<N>.txtfiles, which hold the raw console. - Recompute the median with any tool.
- Compare
env.json's ELF hash with your own build of the same revision. Reproducible builds aren't guaranteed, since the ELF embeds build times.
Saved files show the home directory as ~. Nothing else in a console
capture is changed.
These options narrow or vary a run:
--only compute|threads|scaling|timers|pins|events|faultsruns one group of the Goose or C suite on fresh boots. A Goose run keeps the program it ran asbench.goose, and a C run thebench_local.hthat named its group tobench.c. The report marks a group run's numbers with †. Thepinsgroup was added after every implementation's full run, so its numbers come from runs of that group alone.--prio-up Nruns the suite's main program N priorities above its workers, and--busy Nspins N workers besidetimer_busyandpin_busy, in Goose and C.--only eventsis the timers and the pins together. A run with--prio-upor--busyneeds a--dir: every table here is priority 0 with one busy worker (Optimizations, section 11).--labelnames the run.--dirsaves the run in a subfolder ofbench/results/, which the report doesn't read. The correctness investigation keeps its runs inbench/results/correctness/.bench/results/before/holds runs of main just before an optimization, where main had changed since the last published run.
What this suite doesn't cover yet¶
These gaps aren't filled yet. Each one is a known gap, not an oversight:
- Interrupt latency from a pin in Rust, TinyGo and MicroPython. The
pin_*benchmarks are written in Goose and C only. They time the edge's interrupt to the program, not the edge to its interrupt: the stamp is taken inside the interrupt, as the timer benchmarks' is. - Allocation-heavy and string workloads. Goose's arrays live on data stacks, not the heap, so "the same allocation pattern" needs its own definition first.
- Same-core against cross-core communication. The baseline lets the
scheduler place workers, and
@meta queue_worker_corerecords where the producer ran. - Application complexity, beyond a count: the report has the lines of code each implementation's suite takes.
- Power.