Here are the details on NuttX thread metric benchmark results as presented here, how tests are implemented and what configuration was used to run these tests. Benchmark results history is also provided on this page. Currently NuttX is only benchmarked in single configuration with kernel / usermode separation turned off.
First chart shows comparison of NuttX to other RTOSes in terms of “instructions per benchmark iteration”. The data is derived from NuttX benchmark score and known CPU frequency. Actual numbers are summarized in the table below. This metric estimates instruction count needed to perform one benchmark iteration involving all the typical overhead of the running system. In fact, this metric shows CPU cycles consumed to perform one benchmark iteration rather than instructions. Yet the term “IPC” is used for this purpose and understood in the industry, so we will stick to this use as well. Lower IPC means that one iteration can finish earlier and system can achieve higher performance.
| Test Name | NuttX 13.1.0 |
|---|---|
| Calibration | 12.03 |
| Message Passing | 1531.4 |
| Synchronization | 191.79 |
| Cooperative Scheduling | 601.48 |
| Preemptive Scheduling | 1127.99 |
We configured our NuttX build to resemble configuration of other systems as closely as possible. Therefore, our NuttX build had debug disabled. The relevant portion of defconfig is below:
CONFIG_ARCH_CHIP="stm32l4"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32L432KB=y
CONFIG_ARCH_CHIP_STM32L4=y
CONFIG_BASE_DEFCONFIG="stm32l476-mdk/nsh"
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STACKDUMP=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_SYMBOLS_LEVEL="-ggdb3"
CONFIG_RR_INTERVAL=0
CONFIG_USEC_PER_TICK=1000
We let NuttX decide its optimization flags and enabled full optimization. As with other builds, we generated debug symbols to actually retrieve test results. Timer tick was set to 1ms as with other RTOS kernels.
Mutex priority inversion handling wasn’t enabled in kernel which provided NuttX with slight performance advantage over other kernels which don’t have switch that can turn it off.
Following chart is a comparison of NuttX and CMRX performance in thread metric benchmark. The chart displays same data as main benchmark chart, with only NuttX and CMRX present. Whichever of two systems gained higher score is selected as reference for given benchmark test, the score of latter system is displayed as fraction of other’s system. So for example a score of 82% would mean that slower system got 82% of score of faster of two RTOSes.
Below is chart displaying performance history of NuttX releases in thread metric benchmark. Chart displays scores achieved in each of benchmarks (except basic processing benchmark) for each tested NuttX release. Version history goes all the way back to NuttX 13.0.0. Older NuttX versions didn’t support CMake-based buildsystem and thus our benchmark couldn’t be built on them.
Purpose: Measures raw processing throughput without kernel overhead.
Method: A single thread continuously increments a counter in a tight loop.
What It Measures: Maximum achievable loop iterations, establishing a baseline for comparing kernel overhead in other benchmarks.
Purpose: Measures voluntary context switch efficiency.
Method: Five threads at equal priority take turns executing. Each thread increments its counter and yields control.
Kernel Primitives Used:
sched_yield() - voluntary context switchWhat It Measures: Cost of voluntary context switches when threads explicitly yield CPU to peers of equal priority.
Purpose: Measures priority-based preemptive context switch efficiency.
Method: Five threads with different priorities form a chain. Thread 0 (lowest priority) resumes thread with priority 1. This chain continues up until thread 4 which only suspends itself. Each of threads 1 - 4 (except of thread with lowest priority) suspends itself once thread with higher priority is resumed.
Kernel Primitives Used:
sem_wait() - suspend task waiting for semaphoresem_post() - signal semaphore, wake up tasks waiting for itWhat It Measures: Cost of involuntary (preemptive) context switches driven by priority differences and thread suspending / resuming.
Purpose: Measures message queue operation overhead.
Method: A single thread sends a message to a queue and immediately receives it back, measuring round-trip message passing cost.
Kernel Primitives Used:
mq_open() - create message queuemq_send() - send message to queuemq_receive() - receive message from queueWhat It Measures: Combined cost of enqueueing and dequeueing messages (16-byte messages, queue depth 16).
Purpose: Measures mutex operation overhead.
Method: A single thread repeatedly acquires and releases a mutex, measuring lock/unlock cycle cost.
Kernel Primitives Used:
pthread_mutex_create() - mutex definitionpthread_mutex_lock() - acquire mutexpthread_mutex_unlock() - release mutexWhat It Measures: Cost of uncontended mutex acquisition and release (no actual contention since single thread).