Use more aggressive gc thresholds for a big speedup by JukkaL · Pull Request #18306 · python/mypy (original) (raw)

JukkaL

In some cases gc was consuming a significant fraction of CPU, so run gc less often.

This made incremental checking of torch 27% faster for me (based on 100 measurements), and also speeds up incremental self check by about 20% and non-incremental self check by about 10%. All measurements were on Python 3.13.

@JukkaL

In some cases gc was consuming a significant fraction of CPU, so run gc less often. Also tune gc very early, to run gc less during import time -- not sure if this has any significant impact, but in an unrelated project this was somewhat helpful.

This makes incremental checking of torch 27% faster (based on 100 measurements), and also speeds up self check by about 10% (both incremental and non-incremental).

@JukkaL

Don't merge yet -- I'm still performing some additional measurements. I'm not sure if tuning very early is actually useful.

@github-actions GitHub Actions

This comment has been minimized.

@JukkaL

@JukkaL

@JukkaL

I simplified the PR, since tuning GC early before most imports seemed to make this a little bit slower instead of faster.

@JukkaL JukkaL changed the titleUse more aggressive gc thresholds, and tune earlier Use more aggressive gc thresholds for a big speedup

Dec 19, 2024

@github-actions GitHub Actions

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅