branchmap: remove the dict interface from the branchcache class (API)
ClosedPublic

Authored by pulkit on Mar 19 2019, 7:30 AM.

Details

Summary

The current branchmap computation involves reading the whole branchmap from
disk, validating all the nodes even if they are not required. This leads to a
lot of time on repos which have large branchmap or a lot of branches. On large
repos, this can validate around 1000's of nodes.

On some operations, like finding whether a branch exists or not, we don't need
to validate all the nodes. Or updating heads for a single branch.

Before this patch, branchcache class was having dict interface and it was hard
to keep track of reads.

This patch removes the dict interface. Upcoming patches will implement lazy
loading and validation of data and implement better API's.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
pulkit created this revision.Mar 19 2019, 7:30 AM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Sat, Mar 23, 9:10 PM
def copy(self):
    """return an deep copy of the branchcache object"""
  • return type(self)(
  • self, self.tipnode, self.tiprev, self.filteredhash, + return branchcache( + self.entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes)

In order to support subclassing, a branchcache type has to be resolved
dynamically. IIRC, that's the point of type(self) use here.