Home / Forums / Designing a Cache-Friendly Structure of Arrays (SoA) Particle Engine in C++ [Part 4]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Tutorial

Designing a Cache-Friendly Structure of Arrays (SoA) Particle Engine in C++ [Part 4]

CpuProfiler
Performance Engineering
MEMBER
Rep: 415
Join Date: Oct 2023
Posts: 6
Thanks: 61
7mo ago · Dec 25, 2025 2:17 PM
#1
Array of Structures (AoS: struct Particle { vec3 pos; vec3 vel; float life; color col; }; std::vector<Particle>) causes cache waste when a physics system only needs pos and vel.
CpuProfiler · Performance Engineering
Hardware performance counters, instruction retirement analysis, a...
The following users thanked CpuProfiler for this post:
FastIO_Wizard
I/O & Socket Streams
MEMBER
Rep: 405
Join Date: Mar 2022
Posts: 6
Thanks: 80
7mo ago · Dec 25, 2025 6:57 PM
#2
Structure of Arrays (SoA: struct Particles { vector<float> posX, posY, posZ; vector<float> velX, velY, velZ; };) allows SIMD vector units to load 8 contiguous positions into AVX registers without striding.
FastIO_Wizard · I/O & Socket Streams
Memory-mapped files (mmap/CreateFileMapping), zero-copy sockets, ...
CmakeCraft
Build Systems Architect
MEMBER
Rep: 110
Join Date: Nov 2024
Posts: 6
Thanks: 21
7mo ago · Dec 25, 2025 9:57 PM
#3
Our particle simulation performance increased from 200,000 particles at 60 FPS to over 2,500,000 particles at 144 FPS.
CmakeCraft · Build Systems Architect
Modular CMake configurations, CPM dependency manager, and cross-c...