C++

Diving Deep into Data Alignment

Recently I came across an interesting topic on memory access optimization named data alignment. I know that struct can be seen as public class, and the performance of struct of array is better than array of struct thanks to contiguous memory. But how can the order of elements in a class/struct make a difference? With those questions in mind, I did a little research. This post is organized in the following way: