Replace internal NumberOfCores by CpuCoreCounter#78
Conversation
|
I am torn about this; on one hand, I am a big fan of using libraries to avoid rehashing the same solution (and I love that this is a problem already solved!), and on another hand, we already experienced issues in the past about dependencies #31 which resulted in one dependency being removed. I'll have a think... 🤔 |
|
@asgrim sorry didn't see your reply. I think it's very reasonable to be wary of dependencies as a rule, and for a project that is a lot more critical such as pie/Composer, it is more true than ever. But like for Composer's XdebugHandler, there is still value in packages, even if sometimes they are very simple (code-wise). So whilst there is ways to get away with a cheap code, properly fixing this problem (the CPU core count), is much harder. When I created that repo, I expect nothing more than a copy/paste of the PHPStan code. But as usual, you dig a bit deeper, and you find there is more cases & problems (similarly XdebugHandler did grow quite a bit – for the better, from its initial code). I agree it is very important that this project has good control on the dependencies. So if needed I'm happy to both give control as a "backup" and adapt some constraints if necessary (FYI it already does some heavy compromises such as being PHP 7.2 compatible for PHPStan). |
e45566e to
1a16bff
Compare
|
Thanks @theofidry ! |
CpuCoreCounter is the de-facto standard to get either the number of cores, or, more recently, the number of cores available for parallelization. You can see theofidry/cpu-core-counter#11 for the motivations behind this library