We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8449bb5 commit 0f160f8Copy full SHA for 0f160f8
1 file changed
mypy/build.py
@@ -961,7 +961,7 @@ def parse_all(self, states: Iterable[State]) -> None:
961
# TODO: we should probably use psutil instead.
962
# With psutil we can get a number of physical cores, while all stdlib
963
# functions include virtual cores (which is not optimal for performance).
964
- available_threads = len(os.sched_getaffinity(0))
+ available_threads = os.cpu_count() or 2 # conservative fallback
965
# For some reason there is no visible improvement with more than 8 threads.
966
# TODO: consider writing our own ThreadPool as an optimization.
967
with ThreadPoolExecutor(max_workers=min(available_threads, 8)) as executor:
0 commit comments