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)
#!/bin/sh
#
# Use this script to generate branches.svndump
#
mkdir temp
cd temp
mkdir project-orig
cd project-orig
mkdir trunk
mkdir branches
cd ..
svnadmin create svn-repo
svnurl=file://`pwd`/svn-repo
svn import project-orig $svnurl -m "init projA"
svn co $svnurl project
cd project
echo a > trunk/a
echo b > trunk/b
echo c > trunk/c
mkdir trunk/dir
echo e > trunk/dir/e
# Add a file within branches, used to confuse branch detection
echo d > branches/notinbranch
svn add trunk/a trunk/b trunk/c trunk/dir branches/notinbranch
svn ci -m hello
svn up
# Branch to old
svn copy trunk branches/old
svn rm branches/old/c
svn rm branches/old/dir
svn ci -m "branch trunk, remove c and dir"
svn up
# Update trunk
echo a >> trunk/a
svn ci -m "change a"
# Update old branch
echo b >> branches/old/b
svn ci -m "change b"
# Create a cross-branch revision
svn move trunk/b branches/old/c
echo c >> branches/old/c
svn ci -m "move and update c"
# Update old branch again
echo b >> branches/old/b
svn ci -m "change b again"
# Move back and forth between branch of similar names
# This used to generate fake copy records
svn up
svn move branches/old branches/old2
svn ci -m "move to old2"
svn move branches/old2 branches/old
svn ci -m "move back to old"
# Update trunk again
echo a > trunk/a
svn ci -m "last change to a"
# Branch again from a converted revision
svn copy -r 1 $svnurl/trunk branches/old3
svn ci -m "branch trunk@1 into old3"
cd ..
svnadmin dump svn-repo > ../branches.svndump