changeset 51560:8e8776a28683

perf: create the temporary target next to the source in stream-consume See inline comment for rational.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 03 Apr 2024 15:33:25 +0200
parents c4aab3661f25
children 4a9d0898bf16
files contrib/perf.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Tue Apr 02 21:53:17 2024 +0200
+++ b/contrib/perf.py	Wed Apr 03 15:33:25 2024 +0200
@@ -2188,10 +2188,18 @@
 
     run_variables = [None, None]
 
+    # we create the new repository next to the other one for two reasons:
+    # - this way we use the same file system, which are relevant for benchmark
+    # - if /tmp/ is small, the operation could overfills it.
+    source_repo_dir = os.path.dirname(repo.root)
+
     @contextlib.contextmanager
     def context():
         with open(filename, mode='rb') as bundle:
-            with tempfile.TemporaryDirectory() as tmp_dir:
+            with tempfile.TemporaryDirectory(
+                prefix=b'hg-perf-stream-consume-',
+                dir=source_repo_dir,
+            ) as tmp_dir:
                 tmp_dir = fsencode(tmp_dir)
                 run_variables[0] = bundle
                 run_variables[1] = tmp_dir