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
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
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
> > 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
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 =
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
> +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,
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