When accesses cluster, a small fast store catches most of them
When a processor runs a loop, it reads the same few instructions millions of times: this is temporal locality. When it goes through a table, it reads one cell and then the one next to it: this is spatial locality. Because reads keep crowding into one small area, a small, fast store that holds on to that area means most requests never have to go to slow memory.
A little more hit rate, a lot less waiting on average
Checking the cache takes c nanoseconds; if the item isn't there, fetching it from memory takes another m nanoseconds. Finding it in the cache is called a hit, and the share of hits is written h. The average wait each time is:
c+(1−h)m
Every request checks the cache first, and only the part that misses spends the extra m. Say c is 1 and m is 100. At a 50% hit rate the average is 51 nanoseconds; at 90%, 11 nanoseconds; at 99%, 2 nanoseconds. Going from 90% to 99% cuts the misses from one in ten to one in a hundred, and every miss means waiting an extra 100 nanoseconds, so the average time shrinks to less than a fifth of what it was.
Store an extra copy, and it takes ten uses to break even
Building a table of results takes 90 seconds, working out one answer on the spot takes 10 seconds, and looking one up in the table takes 1 second. Each use saves 9 seconds, so it takes exactly 10 uses to break even. Use it only 3 times and you've wasted 63 seconds; use it 100 times and you save 810 seconds net.
Things that are read often and changed rarely suit caching best: the instructions in a loop, popular movies. For numbers that change all the time, like an account balance or the number of seats left, once the original changes, the copy gives the wrong answer, so you have to ask the original before reading. If you keep a copy of everything, the copies pile up so high that finding one is slower than working it out again.