perf: create the temporary target next to the source in stream-consume
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 03 Apr 2024 15:33:25 +0200
changeset 51560 8e8776a28683
parent 51558 c4aab3661f25
child 51573 4a9d0898bf16
perf: create the temporary target next to the source in stream-consume See inline comment for rational.
contrib/perf.py
--- 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