Page MenuHomePhabricator

branchmap: pass changelog into revbranchcache.branchinfo()
AbandonedPublic

Authored by pulkit on Oct 19 2018, 1:38 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

We call branchinfo() function into for-loops and each branchinfo() calls try to
access repo.changelog.

As D5161 introduced the functionality to pass a chnagelog into that function to
prevent accessing repo.changelog in loops, let's use that.

Timings of hg perfrevset 'branch("tip")' on hg-committed before and after:

Before
! wall 0.133497 comb 0.140000 user 0.130000 sys 0.010000 (best of 64)
! wall 0.139459 comb 0.150000 user 0.150000 sys 0.000000 (best of 57)

After
! wall 0.106518 comb 0.110000 user 0.100000 sys 0.010000 (best of 77)
! wall 0.106157 comb 0.110000 user 0.100000 sys 0.010000 (best of 83)

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Oct 19 2018, 1:38 PM
yuja added a subscriber: yuja.Oct 20 2018, 3:19 AM
! wall 0.133497 comb 0.140000 user 0.130000 sys 0.010000 (best of 64)
! wall 0.139459 comb 0.150000 user 0.150000 sys 0.000000 (best of 57)
After
! wall 0.106518 comb 0.110000 user 0.100000 sys 0.010000 (best of 77)
! wall 0.106157 comb 0.110000 user 0.100000 sys 0.010000 (best of 83)

I'm surprised that unfilteredrepo.changelog is also slow.

  • a/mercurial/localrepo.py

+++ b/mercurial/localrepo.py
@@ -2037,8 +2037,9 @@

if full:
    rbc = self.revbranchcache()

+ cl = self.changelog

Perhaps it has to be self.unfiltered().changelog because revbranchcache is
initialized with the unfiltered repo.

for r in self.changelog:
  • rbc.branchinfo(r)

+ rbc.branchinfo(r, changelog=cl)

Can't we just make revbranchcache keep repo.changelog reference? It doesn't
make sense to pass in repo.changelog as an argument, whereas the repo is
held by revbranchcache.

yuja added a comment.Oct 20 2018, 3:36 AM
rbc = self.revbranchcache()

+ cl = self.changelog

Perhaps it has to be self.unfiltered().changelog because revbranchcache is
initialized with the unfiltered repo.

Never mind. It doesn't matter so long as the passed rev isn't filtered.

I think this patch can be abandoned because of other work late in the 4.8 cycle?

pulkit abandoned this revision.Nov 14 2018, 5:40 AM

I think this patch can be abandoned because of other work late in the 4.8 cycle?

Yep!