comparison mercurial/phases.py @ 51516: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 c9ceb4f60256
children 4ee50d98d35c
comparison
equal deleted inserted replaced
51514:394ea4428163 51516:e0f92bd98c24
905 changed_revs[r] = r_phase 905 changed_revs[r] = r_phase
906 elif r in currentroots: 906 elif r in currentroots:
907 replaced_roots.add(r) 907 replaced_roots.add(r)
908 sets = self._phasesets 908 sets = self._phasesets
909 sets[targetphase].update(changed_revs) 909 sets[targetphase].update(changed_revs)
910 for r, old in changed_revs.items(): 910 if targetphase > draft:
911 if old > public: 911 for r, old in changed_revs.items():
912 sets[old].discard(r) 912 if old > public:
913 sets[old].discard(r)
913 914
914 if new_roots: 915 if new_roots:
915 assert changed_revs 916 assert changed_revs
916 917
917 final_roots = new_roots | currentroots - replaced_roots 918 final_roots = new_roots | currentroots - replaced_roots