Reordering members can lead to better packing and a smaller memory footprint, due to how alignment works. If you’re iterating a large number of objects, having smaller objects is very favorable in terms of cache locality; you get fewer cache misses, and prefetching is more effective.
For the curious: pahole is a very useful tool for this type of code analysis.
I watched a video on this, the way they managed it was by reordering variables in structs. That’s kinda insane
Not a surprise, considering the amount of data and processes the kernel manages.
Can you link video?
Probably this is the video https://www.youtube.com/watch?v=qo1FFNUVB-Q
Reordering members can lead to better packing and a smaller memory footprint, due to how alignment works. If you’re iterating a large number of objects, having smaller objects is very favorable in terms of cache locality; you get fewer cache misses, and prefetching is more effective.
For the curious: pahole is a very useful tool for this type of code analysis.
Oh to increase cache hits?
Edit: Ok I read the article, yes more cache hits. It’s neat how they put more context for the title in the link in case one gets curious about it!