Cache-Conscious Structure Layout

  • Trishul Chilimbi ,
  • Mark D. Hill ,
  • James R. Larus

Proceedings of the ACM SIGPLAN'99 Conference on Programming Language Design and Implementation |

Published by ACM SIGPLAN

Hardware trends have produced an increasing disparity between processor speeds and memory access times. While a variety of techniques for tolerating or reducing memory latency have been proposed, these are rarely successful for pointer-manipulating programs. This paper explores a complementary approach that attacks the source (poor reference locality) of the problem rather than its manifestation (memory latency). It demonstrates that careful data organization and layout provides an essential mechanism to improve the cache locality of pointer-manipulating programs and consequently, their performance. It explores two placement techniques—clustering and coloring—that improve cache performance by increasing a pointer structure’s spatial and temporal locality, and by reducing cache-conflicts. To reduce the cost of applying these techniques, this paper discusses two strategies—cache-conscious reorganization and cacheconscious allocation—and describes two semi-automatic tools— ccmorph and ccmalloc—that use these strategies to produce cache-conscious pointer structure layouts. ccmorph is a transparent tree reorganizer that utilizes topology information to cluster and color the structure. ccmalloc is a cache-conscious heap allocator that attempts to co-locate contemporaneously accessed data elements in the same physical cache block. Our evaluations, with microbenchmarks, several small benchmarks, and a couple of large real-world applications, demonstrate that the cache-conscious structure layouts produced by ccmorph and ccmalloc offer large performance benefits—in most cases, significantly outperforming state-of-the-art prefetching.