September 10, 2001 | Quantitative Analysis of Memoization | Slide #5 |
Let's suppose we make N calls to m
Suppose the cache hit rate is h
Cache miss rate is 1-h
The real f gets called about N(1-h) times
Suppose the average time for f to execute is f
Time spent in f is N(1-h)f
Suppose the average time to manage the cache is K
Time spent managing the cache is NK
Total time spent for N calls: N(1-h)f + NK
Average time per call: (1-h)f + K
Next | Copyright © 2001 M-J. Dominus |