branchmap: Save changectx creation during update
The newly introduced `branchmap` function allows us to skip the
creation of changectx objects. This speeds up the construction of
the branchmap.
On the mozilla repository (117293 changesets, 15490 mutable)
Before:
! impactable 19.9
! mutable 0.576
! unserved 3.16
After:
! impactable 7.03 (2.8x faster)
! mutable 0.352 (1.6x)
! unserved 1.15 (2.7x)
On the cpython repository (81418 changesets, 6418 mutable)
Before:
! impactable 15.9
! mutable 0.451
! unserved 0.861
After:
! impactable 6.55 (2.4x faster)
! mutable 0.170 (2.6x faster)
! unserved 0.289 (2.9x faster)
On the pypy repository (58852 changesets)
Before:
! impactable 13.6
After:
! impactable 6.17 (2.2x faster)
On my Mercurial repository (18295 changesets, 2210 mutable)
Before:
! impactable 23.9
! mutable 0.368
! unserved 0.057
After:
! impactable 1.31 (18x faster)
! mutable 0.042 (8.7x)
! unserved 0.025 (2.2x)
$ hg init 1
$ echo '[ui]' >> 1/.hg/hgrc
$ echo 'timeout = 10' >> 1/.hg/hgrc
$ echo foo > 1/foo
$ hg --cwd 1 ci -A -m foo
adding foo
$ hg clone 1 2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone 2 3
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo '[hooks]' >> 2/.hg/hgrc
$ echo 'changegroup.push = hg push -qf ../1' >> 2/.hg/hgrc
$ echo bar >> 3/foo
$ hg --cwd 3 ci -m bar
$ hg --cwd 3 push ../2
pushing to ../2
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files