libgit2/libgit2 — pull request #1388 by carlosmn (2013-03-03 22:29:32+00:00)
Title: indexer: use a hashtable for keeping track of offsets

These offsets are needed for REF_DELTA objects, which encode which
object they use as a base, but not where it lies in the packfile, so
we need a list.

These objects are mostly from older packfiles, before OFS_DELTA was
widely spread. The time spent in indexing these packfiles is greatly
reduced, though remains above what git is able to do.

---

This is still two to three times slower than git on the same packfile. `perf` says we spend 55% of the time inflating, so it's most likely due to git caching the deltas in full, while we inflate them twice. We're unlikely to find this type of old packfile in the wild, as most should come from some git server which can generate `OFS_DELTA`, so I wouldn't worry too much about it, as we're not embarrassingly slow anymore.