Skip to content

Use more aggressive gc thresholds for a big speedup #18306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ def _build(
extra_plugins: Sequence[Plugin],
) -> BuildResult:
if platform.python_implementation() == "CPython":
# This seems the most reasonable place to tune garbage collection.
gc.set_threshold(150 * 1000)
# Run gc less frequently, as otherwise we can spent a large fraction of
# cpu in gc. This seems the most reasonable place to tune garbage collection.
gc.set_threshold(200 * 1000, 30, 30)

data_dir = default_data_dir()
fscache = fscache or FileSystemCache()
Expand Down
Loading