• Ashley
    link
    fedilink
    357 months ago

    I watched a video on this, the way they managed it was by reordering variables in structs. That’s kinda insane

    • qnrd
      link
      fedilink
      127 months ago

      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.

    • @markus99
      link
      47 months ago

      Not a surprise, considering the amount of data and processes the kernel manages.

    • @Buddahriffic
      link
      3
      edit-2
      7 months ago

      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!