This is an archive of the discontinued Mercurial Phabricator instance.

phases: sparsify phase lists
ClosedPublic

Authored by joerg.sonnenberger on Jul 7 2020, 6:38 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Commits
rHGb1e51ef4e536: phases: sparsify phase lists
Summary

When the internal and archived phase was added, allphase became a large,
sparsely populated list. This dramatically increased the number of
lookup operations for public relations in phasecache.phase. As a first
step, define allphases and related lists explicitly to contain only the
actual phases. Make phasenames a dictionary and create corresponding
dictionaries for mapping phase names back to numbers. Adjust various
list to be sparse as well with the exception of phaseroots and phasesets
members of phasecache. Keep those as a separate step as it involves
changes to the C module.

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.

Event Timeline

pulkit added a subscriber: pulkit.Jul 10 2020, 3:51 PM
pulkit added inline comments.
mercurial/phases.py
152

These all makes me think that we need a class here. What do you think?

mercurial/phases.py
152

I'm not sure if turning the various lists into predicates or so would actually improve anything. I did change this from the original form to make it easier to reason about them, but otherwise this part is a NFC. Anything more would be much more intrusive and possibly also affect 3rd party extensions like evolve with non-trivial follow-up changes. It doesn't seem to be worth the effort.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.