It would be helpful to detect hosts with many cores, but limited RAM. (eg. a Pi with 4 cores but only 1GB of RAM) Such systems often can't compile multiple objects without paging onto very slow storage, which defeats the purpose of parallel compilation.
I see two parts:
A portable way to detect available RAM (and swap?).
A heuristic for deciding how to limit concurrency.
f82966c2e78e8fe0ff16edb6cd87e9d22e864a1d attempts to apply a (probably crude) test looking for 512MB of available RAM per prospective parallel job. This is only done when run on Linux.
https://github.com/mdavidsaver/setuptools_dso/blob/0b7223087d0d25b43fc31f095d0987513002a5e3/src/setuptools_dso/dsocmd.py#L354
It would be helpful to detect hosts with many cores, but limited RAM. (eg. a Pi with 4 cores but only 1GB of RAM) Such systems often can't compile multiple objects without paging onto very slow storage, which defeats the purpose of parallel compilation.
I see two parts: