D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-23 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG50a64c321c1e: branchmap: build the revbranchcache._namesreverse() only when required (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-22 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 12586. pulkit edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5291?vs=12576=12586 REVISION DETAIL https://phab.mercurial-scm.org/D5291 AFFECTED FILES mercurial/branchmap.py

D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-22 Thread yuja (Yuya Nishihara)
yuja added a comment. > > Maybe _namesreverse can be a propertycache, instead of duplicating it. > > `del self.__dict__[r'...']` can be used to discard the cache. > > Hm, I am not sure if I feel good about doing `del self.__dict__[r'...']` thing. It's pretty common in

Re: D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-22 Thread Yuya Nishihara
> > Maybe _namesreverse can be a propertycache, instead of duplicating it. > > `del self.__dict__[r'...']` can be used to discard the cache. > > Hm, I am not sure if I feel good about doing `del self.__dict__[r'...']` > thing. It's pretty common in Mercurial codebase. That said, I

D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-22 Thread pulkit (Pulkit Goyal)
pulkit added a comment. In https://phab.mercurial-scm.org/D5291#78794, @yuja wrote: > > +if self._namesreverse is None: > > +self._namesreverse = dict((b, r) for r, b in enumerate(self._names)) > > > > if b in self._namesreverse: > > branchidx =

D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-21 Thread yuja (Yuya Nishihara)
yuja added a comment. > +if self._namesreverse is None: > +self._namesreverse = dict((b, r) for r, b in enumerate(self._names)) > > if b in self._namesreverse: > branchidx = self._namesreverse[b] > else: > > @@ -467,6 +469,8 @@ > > def

Re: D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-21 Thread Yuya Nishihara
> +if self._namesreverse is None: > +self._namesreverse = dict((b, r) for r, b in > enumerate(self._names)) > if b in self._namesreverse: > branchidx = self._namesreverse[b] > else: > @@ -467,6 +469,8 @@ > > def setdata(self, branch, rev,

D5291: branchmap: build the revbranchcache._namesreverse() only when required

2018-11-21 Thread pulkit (Pulkit Goyal)
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY On big repositories with a lot of named branches and that also increasing over time, building of this dict can be expensive and shows up in profile. For our