# HG changeset patch # User Pierre-Yves David # Date 1713055215 -7200 # Node ID a6bdd2e6f7cb374f233f7676b8741eebac6ccc59 # Parent 90ef3e042e108ce0baeab8e1e2a2a1d5933960d2 perf: run the gc before each run The python garbage collector is a large source of performance troubles, we run it right before the timed section to reduce the change for the gc to add noise to the benchmark. diff -r 90ef3e042e10 -r a6bdd2e6f7cb contrib/perf.py --- a/contrib/perf.py Sun Apr 14 02:38:41 2024 +0200 +++ b/contrib/perf.py Sun Apr 14 02:40:15 2024 +0200 @@ -581,6 +581,7 @@ if setup is not None: setup() with context(): + gc.collect() with prof: with timeone() as item: r = func()