Skip to content

Floating point benchmark on Raspberry Pi Pico and other microcontrollers

Notifications You must be signed in to change notification settings

tana/pico_float_bench

Repository files navigation

Float benchmark on Raspberry Pi Pico

Files

  • float_bench.c: benchmark program for Raspberry Pi Pico
  • float_bench_arduino/ directory: benchmark program for Arduino-based environments, such as ESP32, for comparison.

Methods

The benchmark tasks are:

  1. Generate 4000 Gaussian random numbers using Box-Muller method.
  2. Calculate mean of them.
  3. Calculate variance of them.

Results

Board Chip Arch Clock [MHz] FPU SDK Generation [us] Mean calculation [us] Variance calculation [us]
Raspberry Pi Pico RP2040 Cortex-M0+ 1251 No Pico SDK 49081 11560 17100
Raspberry Pi Pico RP2040 Cortex-M0+ ?2 No Arduino mbed core 248237 27350 36410
Raspberry Pi Pico RP2040 Cortex-M0+ 133 No Arduino-Pico (by Earle Philhower) 44557 10420 15168
ESP32-DevKitC ESP32 Xtensa LX6 240 Yes Arduino 11965 3217 3334
AtomS3 ESP32-S3 Xtensa LX7 240 Yes Arduino 9369 1138 1278
M5Stamp C3 ESP32-C3 RV32IMC 160 No Arduino 135386 13638 19240
Seeeduino Xiao ATSAMD21G18A-MU Cortex-M0+ 48 No Arduino 679416 83082 113193
Wio Terminal ATSAMD51P19 Cortex-M4 120 Yes Arduino 29235 836 936
Nucleo F411RE STM32F411RE Cortex-M4 100 Yes STM32duino 16284 1014 1139
Arduino UNO R4 WiFi RA4M1 Cortex-M4 48 Yes Arduino 81498 2094 2344

Note: Above values are results of a single measurement. "Mean calculation" and "Variance calculation" does not intend the mean/variance of results. These are time spent to calculate mean and variance of 4000 Gaussian random numbers.

Discussion

Performance difference between Pi Pico SDK and Arduino Mbed Core

On Raspberry Pi Pico, Arduino version was slower than Pico SDK version despite the chip was the same. It seems because of the difference of software float routines. Current version of Arduino Mbed Core does not use the optimized float routines built in RP2040 (at the time of October 23, 2021). However, it seems to be solved soon. The situation is similar in November 2023.

Footnotes

  1. Default clock frequency (see page 45 of Raspberry Pi Pico C SDK document). Max 133 MHz.

  2. See https://github.com/arduino/ArduinoCore-mbed/issues/221

About

Floating point benchmark on Raspberry Pi Pico and other microcontrollers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published