Shraman Chaudhuri
Firmware & Hardware Benchmark

30SEC BENCHMARK

A standardized 30-second prime number calculation benchmark for Arduino, ESP32, and RISC-V boards. Measures raw arithmetic throughput and CPU efficiency across microcontroller architectures.

Silicon Profiling

BENCHMARK DESIGN

01

Strict 30-Second Timed Window

Leverages millisecond-precise hardware timers to execute a non-blocking prime search loop, terminating cleanly at exactly 30,000ms.

02

Algorithm Optimization

Implements early even-number pruning and step-by-two odd trial division up to sqrt(N), maximizing raw integer computation throughput.

03

Cross-Architecture Support

Runs identically across 8-bit AVR microcontrollers (ATmega328P, ATmega2560) and 32-bit modern processors (ESP32 Xtensa, ESP32-C3 RISC-V).

04

Real-Time Serial Telemetry

Streams immediate diagnostic data and final prime count over USB UART (115200 baud) without CPU-throttling string formatting inside the hot loop.

05

Minimal Memory Overhead

Zero dynamic heap allocation (no malloc/free or String objects) preventing heap fragmentation and ensuring pure bare-metal determinism.

06

Comparative Silicon Profiling

Provides an empirical baseline for comparing clock frequencies, pipeline depths, and instruction cycles across embedded development platforms.

Architecture Matrix

TARGET PLATFORMS

Microcontroller Platform CPU Architecture & Clock Category Arithmetic Characteristics
ESP32 DevKit (Xtensa LX6) 32-bit Dual-Core @ 240MHz High Performance Hardware integer divider & branch prediction
ESP32-C3 Super Mini (RISC-V) 32-bit Single-Core @ 160MHz Modern RISC-V Compact RV32IMC core with efficient caching
Arduino Uno / Nano (ATmega328P) 8-bit AVR @ 16MHz Classic Embedded Pure software 32-bit long integer emulation
Arduino Mega 2560 (ATmega2560) 8-bit AVR @ 16MHz Classic Embedded Expanded flash memory baseline
Deterministic Evaluation

THE ALGORITHM

Core Benchmark Loop

The benchmark initiates with timestamp calibration via millis(), cycling candidate primes through an optimized trial division routine until the 30-second boundary is crossed:

unsigned long startTime = millis();
unsigned long count = 0;
unsigned long candidate = 2;

while (millis() - startTime < 30000) {
    if (isPrime(candidate)) {
        count++;
    }
    candidate++;
}

Serial.print("Primes calculated in 30 seconds: ");
Serial.println(count);
Frameworks & Tooling

TECH STACK

Arduino IDE
C++
ESP-IDF
PlatformIO
AVR Architecture
RISC-V Architecture