branchmap: pass changelog into branchmap functions

Authored by indygreg on Oct 19 2018, 12:56 PM.



As part of building the branchmap, we loop over revs and call branchmap()
or _branchmap(). Previously, these functions were accessing repo.changelog.
We know from past experience that repo.changelog in loops is bad for

This commit teaches the branchmap code to pass a changelog instance into
branchmap() and _branchmap() so we don't need to pay this penalty.

On my MBP, this appears to show a speedup on a clone of the
mozilla-unified repo:

$ hg perfbranchmap --clear-revbranch
! base
! wall 21.078160 comb 21.070000 user 20.920000 sys 0.150000 (best of 3)
! wall 20.574682 comb 20.560000 user 20.400000 sys 0.160000 (best of 3)

$ hg perfbranchmap
! base
! wall 4.880413 comb 4.870000 user 4.860000 sys 0.010000 (best of 3)
! wall 4.573968 comb 4.560000 user 4.550000 sys 0.010000 (best of 3)

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
indygreg created this revision.Oct 19 2018, 12:56 PM
pulkit accepted this revision.Oct 19 2018, 1:08 PM
pulkit added inline comments.Oct 19 2018, 1:14 PM

There is one more call of this function in which is also inside a for-loop. Doing this same thing there will speed up the branch() revset. If possible, can you have a look before the freeze?

pulkit added inline comments.Oct 19 2018, 1:15 PM

Oh, and one more in which is also inside a for loop!

Since these two patches are simple but great speedups, I am queueing them and also I will be sending patches to fix this at other places too if nobody beats me to it.

This revision was automatically updated to reflect the committed changes.