Mercurial > hg-stable
changeset 51465:e0f92bd98c24 stable
phases: avoid a potentially costly dictionary interation in some case
If we retract for the draft phase, there is not non-public item to be retracted
and we can skip this part. This part is was apparently super costly thanks to
Python.
On mozilla-try-2019-02-18, a perf::unbundle call with a 10 000 changesets
bundle gives give use the following timing.
e57d4b868a3e: 4.6 seconds
ac1c75188440: 102.5 seconds
this-changeset: 30.0 seconds
So we recovered about ⅔ of the regression, the next changeset will give us the
rest back.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 25 Mar 2024 01:50:31 +0100 |
parents | 394ea4428163 |
children | 4ee50d98d35c |
files | mercurial/phases.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/phases.py Thu Mar 21 12:24:42 2024 +0100 +++ b/mercurial/phases.py Mon Mar 25 01:50:31 2024 +0100 @@ -907,9 +907,10 @@ replaced_roots.add(r) sets = self._phasesets sets[targetphase].update(changed_revs) - for r, old in changed_revs.items(): - if old > public: - sets[old].discard(r) + if targetphase > draft: + for r, old in changed_revs.items(): + if old > public: + sets[old].discard(r) if new_roots: assert changed_revs