mirror of https://github.com/django/django.git
Reduced the garbage collection frequency in runtests.py.
This commit is contained in:
parent
9760e262f8
commit
b8bb9e1549
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue