Introduce a delta base cache

This increases the speed of indexing (and thus fetching) considerably. Some unscientific testing on a 44MB packfile from git.git shows the following `index-pack` timings:

* 55s without these changes
* 10s with this changes
* 8.5s git's version

Git uses a multi-threaded indexer, so the wall time is smaller. There is still some performance to be squeezed out (the function that evicts entries is way too high in the perf chart) to get to git.git levels, but this gets us close.

As a bonus, this fixes a memory leak in the indexers, which turns out weren't freeing the packfiles properly.