Repository navigation
Runtime Benchmark Comparison
The same five firmware-style scripts as bench/mcu/ (and the three host scripts
of bench/) written idiomatically for each runtime and in plain C, with identical output.
Results and caveats: docs/PERFORMANCE.md.
| Workload | What it does |
|---|---|
fib |
recursive fib(18) — calls/returns |
loop |
50 000-iteration integer loop with %, &, branches, in a function |
objects |
4 × 500 small objects in a list, a method call on each |
sensor |
300 LCG samples into a 64-entry double ring buffer, EMA, average, formatted output |
strings |
build "0,1,…,199,", split it and parse every number |
ports/cortex-m/bench.c, emulated Cortex-M4F / M0 (tools/cm_emu.py). Build with
BENCH_CFLAGS="-DBENCH_MINHEAP -DBENCH_MODES=1" to also binary-search the smallest pool each
script runs in (VM state + 256-slot value stack + frames + GC heap).
MPY=/path/to/micropython sh bench/compare/micropython/build.sh (tested v1.26.0, run
make -C mpy-cross first). Builds MicroPython from ports/embed with
mpconfigport.h (EXTRA_FEATURES ROM level as on stm32/rp2,
computed goto, map lookup cache, double floats, MPZ long ints) and
mpbench.c with the same toolchain, -Os, CPU flags, linker
script and board code as the MicroCS bench firmware, and runs it in the same emulator. Each
script runs on a fresh interpreter from a precompiled .mpy (mpy-cross) and from source;
the instruction count covers interpreter init + load + run, as for MicroCS. It also
binary-searches the smallest GC heap that still prints the right output.
Host: micropython host_time.py fib.py (unix port, best of 50, compile excluded) and the
bench/*.py scripts.
sh bench/compare/nanoframework/run.sh (needs the .NET 8 SDK and nuget.org). Compiles
Program.cs with Roslyn against nanoFramework mscorlib
1.17.12 (+ System.Text for StringBuilder; ArrayList instead of List<T>), converts it
with MetadataProcessor 3.0.104 and runs it on the nanoCLR virtual device (nanoclr
1.1.311, the native x64 nanoCLR) on the PC — nanoFramework has no bare-metal Cortex-M build
that runs in this emulator, so it is compared on the host only.
sh bench/compare/c/build.sh: cbench.c on the same emulated boards with the
same toolchain, -Os, linker script and newlib as the MicroCS firmware (instructions per
workload, output included), plus a host build at -O2. Inputs are read from volatiles so
GCC cannot compute the results at build time.
Timed inside the script on the board (MicroCS: Stopwatch.StartNew() /
ElapsedMilliseconds; MicroPython: time.ticks_ms() / time.ticks_diff()). Results so far
are in PERFORMANCE.md; PRs with other
boards are welcome.
Generated from the MicroCS repository (source branch · revision 37bd1f1). Edit the source files, not the wiki.
Start here
Step-by-step guides
- Guides
- Guide PC Simulator
- Guide ESP32
- Guide ESP32 C3 OLED
- Guide Raspberry Pi Pico
- Guide STM32
- Guide Arduino
- Guide Zephyr
- Guide Peripheral Settings
- Guide DMA
Hardware
- Hardware API
- Power Management
- Bluetooth LE
- CAN Bus
- Rotary Encoders
- Peripheral Configuration
- DMA
- Device Drivers
- Wi Fi and Networking
- U8g2 Displays
- LVGL Graphics
- Filesystem
- Threads
- Scheduler
Ports
- Porting and Build Systems
- Port ESP32
- Port RP2040 RP2350
- Port STM32
- Port STM32 Firmware
- Port Zephyr
- Port NuttX
- Port Arduino
C# and the runtime
- Language
- Standard Library
- JSON
- Standalone Firmware
- MicroCS Studio
- Web Flasher
- Studio Template Authoring
- Examples
- LVGL Examples
Embedding and tuning
- Embedding
- Configuration
- Small MCUs
- Memory Budgets
- Low RAM Firmware Example
- Performance
- Runtime Benchmark Comparison
- Lua Host Benchmark
Internals
Project