We can't rely on having a full cache in memory, so add support for
dumping the cache to disk, and retrieving results later. After calling
cache_repo(), call save_cache_to_database() to dump the cache. This
will dump a list of the git revs and commit dates for each file in the
repo to disk (one per file), so we can easily look things up later
without having to call git again.
Initially attempted to do this with a sqlite database, but it didn't
improve performance when doing a large parallel make - if anything, it
was slower than calling git all the time.
Rough timing comparisons on my 4-core laptop with an SSD, all doing:
$ make clean
$ time make -j8
* without any cache: 85s
* with sqlite cache: 120s
* with this simple list cache: 13s
The cache *does* take quite a bit of space, currently around
300MB. But it's such a big win that I think it's worth it...