Skip to content

Commit e735769

Browse files
committed
fixup! ci: replace workflow set with mimalloc benchmark
Assisted-by: Claude Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent d305eb0 commit e735769

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

ci/bench-mimalloc.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,31 @@
1717
import time
1818

1919

20+
def robust_rmtree(path, attempts=20, delay=0.5):
21+
"""`shutil.rmtree` with retries.
22+
23+
Windows may briefly retain a file lock on objects (e.g. an mmap'd
24+
commit-graph) even after the process that opened them has exited,
25+
causing `rmtree` to raise `PermissionError`. Retry a few times.
26+
"""
27+
for i in range(attempts):
28+
try:
29+
shutil.rmtree(path)
30+
return
31+
except (PermissionError, OSError):
32+
if i == attempts - 1:
33+
raise
34+
time.sleep(delay)
35+
36+
2037
def time_one_repack(binary, template, work):
2138
"""Run `<binary> -C <work> repack -adfq` once and return elapsed seconds.
2239
2340
The work directory is overwritten with a fresh copy of `template`
2441
before the timed command runs.
2542
"""
2643
if os.path.exists(work):
27-
shutil.rmtree(work)
44+
robust_rmtree(work)
2845
shutil.copytree(template, work)
2946
cmd = [binary, "-C", work, "-c", "pack.threads=4", "repack", "-adfq"]
3047
t0 = time.monotonic_ns()

0 commit comments

Comments
 (0)