the nonuniform input distribution is provided in Ta-
ble 6. In addition to high degrees of spatial local-
Table 6: Tree Structure Results, Type II Aware Tree,
Nonuniform Distribution.
B λ γ Φ ∆ w
32 442.06 442.06 1.00 1.00 0
64 442.06 227.35 1.94 0.97 5023
128 442.06 118.9 3.72 0.93 15377
256 442.06 64.16 6.89 0.86 35577
ity regardless of the input distribution, Type II Aware
Trees waste only about 12% of the nodes wasted by
Type I Aware Trees. Consideration of these obser-
vations suggests that adaptive cache aware allocation
schemes are superior to methods that are biased to a
particular key distribution.
7 CONCLUSIONS
It is impossible to ignore the importance of a short
search depth, so a balanced binary tree should always
be among the first choice of a programmer regardless
of the expected key distribution. However, if a uni-
form key distribution is expected and the target archi-
tecture is built around large cache lines, then a cache
aware tree would be an excellent choice as search
depth would not be much greater than the ideal lg n
and the cache performance will be highly elevated.
For nonuniform inputs, it seems much better to uti-
lize a balanced tree because search depth becomes a
major limiting factor. If the cache is made up of very
many large lines, a good alternative may be a Type II
Aware Tree because it will be able to attain high levels
of cache performance despite the nonuniform nature
of the keys.
On the uniform key distribution, the cache perfor-
mance of the trees is ranked as follows: Type I Aware
Tree, Type II Aware Tree, AVL Tree, Vanilla Tree.
On the nonuniform key distribution, the cache per-
formance of the trees is ranked: AVL Tree, Type II
Aware Tree, Type I Aware Tree, Vanilla Tree.
REFERENCES
Adelson-Velskii, G. and Landis, E. (1962). An algo-
rithm for the organization of information. Doklady
Akademii Nauk SSSR. English translation by Myron J.
Ricci in Soviet Math.
Bawawy, A., Aggarwal, A., Yeung, D., and Tseng, C.
(2001). Evaluating the impact of memory system per-
formance on software prefetching and locality opti-
mizations. In 15th Annual Conference on Supercom-
puting, page 486.
Bryant, R. and O’Hallaron, D. (2001). Computer Systems:
A Programmer’s Perspective. Prentice Hall Inc, New
Jersey.
Burger, D. and Austin, T. (2001). The SimpleScalar Tool
Set, Version 2.0. SimpleScalar LLC.
Chilimbi, T., Davidson, B., , and Larus, J. (1999a). Cache-
conscious structure definition. In SIGPLAN ’99 Con-
ference on Programming Languages Design and Im-
plementation (PLDI 99).
Chilimbi, T., Hill, M., and Larus, J. (1999b). Cache-
conscious structure layout. In SIGPLAN ’99 Confer-
ence on Programming Languages Design and Imple-
mentation (PLDI 99).
Chilimbi, T., Hill, M. D., and Larus., J. R. (2000). Making
pointer-based data structures cache conscious. Com-
puter Magazine, 33(12):67.
Cormen, T., Leiserson, C., and Rivest, R. L. (1998). Intor-
duction to Algorithms. The MIT Press.
Fix, J. (2003). The set-associative cache performance of
search trees. In Fourteenth Annual ACM-SIAM Sym-
posium on Discrete Algorithms, page 565.
Hallberg, J., Palm, T., and Brorsson, M. (2003). Cache-
conscious allocation of pointer-based data structures
revisited with hw/sw prefetching. In Second Annual
Workshop on Duplicating, Deconstructing, and De-
bunking(WDDD).
Havran, V. (1997). Cache sensitive representation for bsp
trees. In Computergraphics 97, International Confer-
ence on Computer Graphics, page 369.
Havran, V. (2000a). Analysis of cache sensitive representa-
tion for binary space partitioning trees. Informatica,
23(2):203.
Havran, V. (2000b). Heuristic Ray Shooting Algorithms.
PhD thesis, Czech Technical University.
Iancu, C. and Acharya, A. (2001). An evaluation of search
tree techniques in the presence of caches. In 2001
IEEE International Symposium on Performance Anal-
ysis of Systems and Software.
Oksanen, K. (1995). Memory reference locality in binary
search trees. Master’s thesis, Helsinki University of
Technology.
Puzak, T. B. (2006). The effects of spatial locality on the
cache performance of binary search trees. Master’s
thesis, The University of Connecticut.
Sleator, D. and Tarjan, R. (1985). Self adjusting binary
search trees. Journal ACM, 32:652.
Weiss, M. (1999). Data Structures and Algorithm Analysis
in JAVA. Addison-Wesley Longman Inc.
AN ANALYSIS OF THE EFFECTS OF SPATIAL LOCALITY ON THE CACHE PERFORMANCE OF BINARY
SEARCH TREES
101