Skip to content

Comments

Replace internal NumberOfCores by CpuCoreCounter#78

Merged
asgrim merged 2 commits intophp:mainfrom
theofidry:feat/cpu-core-counter
Nov 19, 2024
Merged

Replace internal NumberOfCores by CpuCoreCounter#78
asgrim merged 2 commits intophp:mainfrom
theofidry:feat/cpu-core-counter

Conversation

@theofidry
Copy link
Contributor

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

@asgrim
Copy link
Contributor

asgrim commented Oct 28, 2024

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 asgrim self-assigned this Oct 28, 2024
@asgrim asgrim added the enhancement New feature or request label Oct 28, 2024
@theofidry
Copy link
Contributor Author

@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).

@asgrim asgrim force-pushed the feat/cpu-core-counter branch from e45566e to 1a16bff Compare November 19, 2024 20:26
@asgrim asgrim added this to the 0.3.0 milestone Nov 19, 2024
@asgrim asgrim merged commit e312977 into php:main Nov 19, 2024
@asgrim
Copy link
Contributor

asgrim commented Nov 19, 2024

Thanks @theofidry !

@theofidry theofidry deleted the feat/cpu-core-counter branch November 19, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants