[PATCH 1 of 3 v2] branchcache: introduce revbranchcache for caching of revision branch names

Matt Mackall mpm at selenic.com
Thu Jan 8 14:21:28 CST 2015


On Thu, 2015-01-08 at 05:23 +0100, Mads Kiilerich wrote:
> The entries for each revision are currently 23 bytes each, and the whole
> revision file will thus be approximately 1/3 of 00changelog.i.

Counterproposal:

[4 byte hash prefix][4 byte branch number with sign bit indicating open]

I think the risks of "collision" here are low (we're not going have a
near-hash-collision that's also a revision collision), so dedicating 20
bytes to detecting them is a bit excessive. Let's instead treat the
field as a "checksum".

Second, I know we've got users with thousands of branch names, so I'd
rather add a bit more headroom there. Rather than 3 bytes for (64k
branches + closed flag), let's use 4 bytes for (2B branches + closed
flag).

This also has the advantage that we can just slurp the data directly
into the array class (plus a possible call to byteswap()).

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list