Mercurial > public > mercurial-scm > hg
comparison mercurial/streamclone.py @ 51547:463e63aa547c
stream-clone: disable gc for `_entries_walk` duration
The number of small container created turn Python in a gc-frenzy that seriously
impact performance.
This significantly boost performance. The following number comes from a large
private repository using perf::stream-locked-section:
base-line: 35.04 seconds
prev-change: 24.51 seconds (-30%)
this-change: 20.88 seconds (-40% from baseline; -15% from previous changes)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 26 Mar 2024 13:32:46 +0000 |
parents | 1b17eeba9deb |
children | 6e4c8366c5ce |
comparison
equal
deleted
inserted
replaced
51546:a452807df09b | 51547:463e63aa547c |
---|---|
768 matcher = None | 768 matcher = None |
769 if includes or excludes: | 769 if includes or excludes: |
770 matcher = narrowspec.match(repo.root, includes, excludes) | 770 matcher = narrowspec.match(repo.root, includes, excludes) |
771 | 771 |
772 phase = not repo.publishing() | 772 phase = not repo.publishing() |
773 entries = _walkstreamfiles( | 773 # Python is getting crazy at all the small container we creates, disabling |
774 repo, | 774 # the gc while we do so helps performance a lot. |
775 matcher, | 775 with util.nogc(): |
776 phase=phase, | 776 entries = _walkstreamfiles( |
777 obsolescence=includeobsmarkers, | 777 repo, |
778 ) | 778 matcher, |
779 for entry in entries: | 779 phase=phase, |
780 yield (_srcstore, entry) | 780 obsolescence=includeobsmarkers, |
781 | 781 ) |
782 for name in cacheutil.cachetocopy(repo): | 782 for entry in entries: |
783 if repo.cachevfs.exists(name): | 783 yield (_srcstore, entry) |
784 # not really a StoreEntry, but close enough | 784 |
785 entry = store.SimpleStoreEntry( | 785 for name in cacheutil.cachetocopy(repo): |
786 entry_path=name, | 786 if repo.cachevfs.exists(name): |
787 is_volatile=True, | 787 # not really a StoreEntry, but close enough |
788 ) | 788 entry = store.SimpleStoreEntry( |
789 yield (_srccache, entry) | 789 entry_path=name, |
790 is_volatile=True, | |
791 ) | |
792 yield (_srccache, entry) | |
790 | 793 |
791 | 794 |
792 def generatev2(repo, includes, excludes, includeobsmarkers): | 795 def generatev2(repo, includes, excludes, includeobsmarkers): |
793 """Emit content for version 2 of a streaming clone. | 796 """Emit content for version 2 of a streaming clone. |
794 | 797 |