Case Studies on Cache Performance and Optimization of Programs with Unit Strides
✍ Scribed by PEI-CHI WU; KUO-CHAN HUANG
- Publisher
- John Wiley and Sons
- Year
- 1997
- Tongue
- English
- Weight
- 118 KB
- Volume
- 27
- Category
- Article
- ISSN
- 0038-0644
No coin nor oath required. For personal study only.
✦ Synopsis
Cache performance in modern computers is important for program efficiency. A cache is thrashing if a significant amount of time is spent moving data between the memory and the cache. This paper presents two cache thrashing examples, one in scientific computing and one in image processing, both of which involve several one-dimensional arrays that are accessed sequentially, i.e., with unit strides. Accessing arrays in unit strides was considered very efficient on cachebased computer systems. However, the existence of cache thrashing is demonstrated by significant increases in computing speed in the equivalent programs tuned for cache locality. This shows that accessing several arrays sequentially may cause cache thrashing. Thus, to improve cache performance, it is important that the compiler or the programmer takes all arrays inside a loop into consideration.