C++ DOD vs OOP ECS Benchmark – Performance and SIMD Analysis
Created:
Sat 10 January 2026written by Xavier Figuera
Last modification:
Sat 10 January 2026C++ Data-Oriented Design vs Object-Oriented Programming Benchmark (DOD vs OOP)
Overview
This project presents a reproducible C++ benchmark comparing Data-Oriented Design (DOD) and Object-Oriented Programming (OOP) approaches in an Entity Component System (ECS) architecture, focusing on CPU performance, cache efficiency, and scalability. The benchmark evaluates execution time using SIMD optimizations (SSE, AVX, AVX-512) across workloads ranging from 10 million to 50 million entities.
The goal is to provide a technical reference for developers interested in high-performance C++ programming and data-oriented software design.
What is Data-Oriented Design?
Data-Oriented Design (DOD) is a programming methodology that prioritizes the layout and access patterns of data in memory over traditional object-oriented abstractions. In C++, DOD often improves cache utilization and allows vectorized operations via SIMD instructions, resulting in higher performance for CPU-intensive applications.
In contrast, Object-Oriented Programming (OOP) focuses on encapsulation, inheritance, and polymorphism, which can introduce scattered memory layouts and additional indirection. This benchmark illustrates the performance impact of these design choices in a practical ECS scenario.
Benchmark Methodology
The benchmark evaluates both OOP and DOD implementations of an ECS system in C++. Execution time is measured across different entity counts (10M, 20M, 50M), and with various SIMD configurations: scalar, SSE, AVX, and AVX-512.
Each test is deterministic: the same input produces the same output. Minor timing fluctuations are caused by system load, operating system scheduling, and background processes.
Metrics collected include:
- Execution time per update cycle
- Speedup of DOD over OOP
- Scalability across entity counts
- SIMD efficiency gains
Statistical Metrics and Data Analysis
For each benchmark configuration, multiple execution time measurements are collected in order to capture both raw performance and run-to-run variability.
Rather than relying on a single timing value, several statistical metrics are computed to provide a more accurate and meaningful performance analysis.
The following metrics are calculated for each benchmark:
- Mean execution time, representing the average performance across repeated runs.
- Minimum execution time, approximating the best-case execution under minimal system interference.
- Maximum execution time, capturing worst-case behavior caused by scheduling noise or background system activity.
- Population standard deviation, used to quantify execution time stability and variability across repetitions.
These metrics are used throughout the benchmark and its visualizations:
- The mean execution time is used as the primary value for performance comparisons and speedup calculations.
- The minimum and maximum values are visualized in performance graphs to illustrate execution time dispersion.
- The population standard deviation provides a quantitative measure of result consistency, allowing performance stability to be compared across ECS implementations and SIMD configurations.
Using these metrics ensures that performance comparisons between DOD and OOP implementations are statistically meaningful and not biased by isolated or outlier measurements.
Statistical Formulas
Mean (average execution time):
$$ \mu = \frac{1}{N}\sum_{i=1}^{N} x_i $$
Minimum execution time:
$$ \min(x) = \min(x_1, x_2, \dots, x_N) $$
Maximum execution time:
$$ \max(x) = \max(x_1, x_2, \dots, x_N) $$
Population standard deviation:
$$ \sigma = \sqrt{\frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2} $$
Where:
- $x_i$ is the execution time measured in the i-th run
- $N$ is the total number of repetitions
- $\mu$ is the mean execution time
- $\sigma$ is the population standard deviation
The population standard deviation is used instead of the sample standard deviation, as the benchmark evaluates the complete set of repeated measurements rather than estimating an underlying distribution.
ECS Implementation Details
The ECS (Entity Component System) in this benchmark is implemented in C++ with a focus on high performance. Components are stored contiguously in memory for DOD to leverage SIMD vectorization. OOP components follow traditional class hierarchies.
Key implementation notes:
- Entities are identified by integer IDs.
- Components are stored in arrays (DOD) or as objects (OOP).
- Systems iterate over component arrays using contiguous memory for DOD.
- SIMD optimizations apply only to DOD layouts for maximum vectorization.
The project uses modern C++20 features and can be compiled with GCC, Clang, or MSVC. Command-line parameters allow flexible benchmarking setups.
Results and Analysis
The benchmark demonstrates that DOD approaches significantly outperform OOP in CPU-bound ECS workloads:
- DOD scales almost linearly with the number of entities, while OOP exhibits superlinear growth.
- SIMD (SSE/AVX) provides up to 5× speedup in DOD layouts.
- OOP implementations cannot fully leverage SIMD due to scattered memory.
Benchmark Results and Explanation
C++ Benchmark MSVC Windows DOD SIMD vs OOP five repetitions analysis
C++ Benchmark MSVC Windows comparison DOD SIMD vs OOP r1 r5 r10 analysis
Benchmark source code repository link
Benchmark repository - Flow Labs Research
These results highlight the benefits of data-oriented design and SIMD optimizations for high-performance C++ applications and ECS architectures.
Conclusions
This benchmark confirms that Data-Oriented Design (DOD) can achieve substantial performance gains over traditional Object-Oriented Programming (OOP) in CPU-intensive ECS workloads, especially when combined with SIMD vectorization.
Developers aiming for high-performance C++ applications should consider DOD principles for component storage and iteration patterns. Using long contiguous arrays and applying SIMD optimizations can dramatically reduce execution time.
The project is fully reproducible, allowing developers to validate and extend the benchmark with custom ECS setups, entity counts, or SIMD configurations.