diff options
| author | Adam Johnson <me@adamj.eu> | 2021-03-17 15:23:04 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-04-13 07:43:29 +0200 |
| commit | b8bb9e1549aa7086c20deae81e3b90b363b4f159 (patch) | |
| tree | 0e3c74b70de73b8266630602ac8b6414a78bdd65 /tests/runtests.py | |
| parent | 9760e262f85ae57df39abe2799eff48a82b14474 (diff) | |
Reduced the garbage collection frequency in runtests.py.
Diffstat (limited to 'tests/runtests.py')
| -rwxr-xr-x | tests/runtests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/runtests.py b/tests/runtests.py index afdf68c21b..a82b183519 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -2,6 +2,7 @@ import argparse import atexit import copy +import gc import os import shutil import socket @@ -53,6 +54,13 @@ warnings.filterwarnings( category=RemovedInDjango41Warning, ) +# Reduce garbage collection frequency to improve performance. Since CPython +# uses refcounting, garbage collection only collects objects with cyclic +# references, which are a minority, so the garbage collection threshold can be +# larger than the default threshold of 700 allocations + deallocations without +# much increase in memory usage. +gc.set_threshold(100_000) + RUNTESTS_DIR = os.path.abspath(os.path.dirname(__file__)) TEMPLATE_DIR = os.path.join(RUNTESTS_DIR, 'templates') |
