stream-clone: disable gc for the initial section for the v3 format
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%)
prev-change: 20.88 seconds (-40%)
this-change: 14.22 seconds (-60% from baseline; -31% from prev)
--- a/mercurial/streamclone.py Tue Mar 26 13:32:46 2024 +0000
+++ b/mercurial/streamclone.py Tue Mar 26 13:34:05 2024 +0000
@@ -850,7 +850,10 @@
- ways to adjust the number of expected entries/files ?
"""
- with repo.lock():
+ # Python is getting crazy at all the small container we creates while
+ # considering the files to preserve, disabling the gc while we do so helps
+ # performance a lot.
+ with repo.lock(), util.nogc():
repo.ui.debug(b'scanning\n')