# HG changeset patch # User Pierre-Yves David # Date 1357926462 -3600 # Node ID 0eed2546118acf26672edf827e6fa18291b1fd0f # Parent 06185554e7e39e711af09ad3715a7f2f7b7db9f6 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) diff -r 06185554e7e3 -r 0eed2546118a mercurial/branchmap.py --- a/mercurial/branchmap.py Thu Jan 10 00:41:40 2013 +0100 +++ b/mercurial/branchmap.py Fri Jan 11 18:47:42 2013 +0100 @@ -149,11 +149,11 @@ heads missing, this function updates self to be correct. """ cl = repo.changelog - ctxgen = (repo[r] for r in revgen) # collect new branch entries newbranches = {} - for c in ctxgen: - newbranches.setdefault(c.branch(), []).append(c.node()) + getbranch = cl.branch + for r in revgen: + newbranches.setdefault(getbranch(r), []).append(cl.node(r)) # if older branchheads are reachable from new ones, they aren't # really branchheads. Note checking parents is insufficient: # 1 (branch a) -> 2 (branch b) -> 3 (branch a)