How to use SDL_GetCPUCacheLineSize(void)

SDL_GetCPUCacheLineSize(void) is used for getting CPU Cachelinesize. But the SDL_GetCPUCacheLineSize is only used in testplatfrom.c and testautomation_platform.c. I want know more about the usages of SDL_GetCPUCacheLineSize.

And i find the code about cacheline always use 128. If my cpu’s cacheline size is 64, does it will affect performance?

Seems like it’s mostly just there because it’s already providing a bunch of other CPU info. It’s useful to know when designing your data structures etc., but AFAIK not much use at runtime.

As SJR said, it’s not very useful at runtime, but knowing your cacheline size can be useful in designing data structures for cache coherence but not much else (nothing else that I can think of). In practice IIRC x86, x86-64/AMD64 (this includes Xbox One and PS4), and most ARM implementations all have a 64-byte (or Uint32[16]) cacheline so it’s actually pretty safe to assume that modern games will almost certainly be run on hardware with a 64-byte cacheline, and design your stuff with this assumption.

If you’re specifically targeting MIPS or other embedded archs (not smartphones) you will probably encounter different cacheline sizes.