Cache Locality and Array Summation Performance: A Surprising Experiment
2025-06-27
This article explores the impact of array element order on summation performance through experimentation. The author compares sequential and random access methods, finding that random access performance drastically degrades when array size exceeds cache capacity, while sequential access remains relatively stable. Experiments also investigate memory-mapped files and cross-platform differences, revealing that OS handling of memory-mapped files significantly impacts performance. The conclusion: sequential access is optimal for large array summation, while larger-than-memory data requires more efficient algorithms and data reading strategies.
Development
cache locality