# HG changeset patch # User Pierre-Yves David # Date 1711460045 0 # Node ID 6e4c8366c5ce836c17d841af2b1fb8215adedbad # Parent 463e63aa547c48b8f891fcc9a1b3f00ceb376ee9 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) diff -r 463e63aa547c -r 6e4c8366c5ce mercurial/streamclone.py --- 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')