Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library design and adoption #11

Closed
5 of 7 tasks
theofidry opened this issue Nov 30, 2022 · 1 comment
Closed
5 of 7 tasks

Library design and adoption #11

theofidry opened this issue Nov 30, 2022 · 1 comment

Comments

@theofidry
Copy link
Owner

theofidry commented Nov 30, 2022

I created this library because I was sick of seeing the same piece/class copied over and over across different projects. This problem is why projects like Composer exist.

When having a brief conversion with Ondrej for the usage of this library, one point of concern is that the different tools may change a tiny bit the way the number of CPU cores are detected based on the system.

I think this library could afford to provide a bit more details on the source and/or allow to veto some sources.

Usages found:

theofidry added a commit to theofidry/phpstan-src that referenced this issue Dec 8, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- /proc/cpuinfo is check _last_
- nproc is checked first (before was not checked at all, it's considered to be more accurate and less convoluted than cpuinfo though)
- not sure about the `return 2`, but this was not too clear [here](phpstan#514 (review)) neither. I could otherwise change the fallback value to return `1` if `proc_open` doesn't exist and 2 otherwise
- add more ways to find the CPU cores count
theofidry added a commit to theofidry/phpstan-src that referenced this issue Dec 8, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- /proc/cpuinfo is check _last_
- nproc is checked first (before was not checked at all, it's considered to be more accurate and less convoluted than cpuinfo though)
- not sure about the `return 2`, but this was not too clear [here](phpstan#514 (review)) neither. I could otherwise change the fallback value to return `1` if `proc_open` doesn't exist and 2 otherwise
- add more ways to find the CPU cores count
theofidry added a commit to theofidry/phpstan-src that referenced this issue Dec 8, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- /proc/cpuinfo is check _last_
- nproc is checked first (before was not checked at all, it's considered to be more accurate and less convoluted than cpuinfo though)
- not sure about the `return 2`, but this was not too clear [here](phpstan#514 (review)) neither. I could otherwise change the fallback value to return `1` if `proc_open` doesn't exist and 2 otherwise
- add more ways to find the CPU cores count
theofidry added a commit to theofidry/phpstan-src that referenced this issue Dec 8, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- /proc/cpuinfo is check _last_
- nproc is checked first (before was not checked at all, it's considered to be more accurate and less convoluted than cpuinfo though)
- not sure about the `return 2`, but this was not too clear [here](phpstan#514 (review)) neither. I could otherwise change the fallback value to return `1` if `proc_open` doesn't exist and 2 otherwise
- add more ways to find the CPU cores count
theofidry added a commit to theofidry/phpstan-src that referenced this issue Dec 10, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- /proc/cpuinfo is check _last_
- nproc is checked first (before was not checked at all, it's considered to be more accurate and less convoluted than cpuinfo though)
- not sure about the `return 2`, but this was not too clear [here](phpstan#514 (review)) neither. I could otherwise change the fallback value to return `1` if `proc_open` doesn't exist and 2 otherwise
- add more ways to find the CPU cores count
theofidry added a commit to theofidry/phpstan-src that referenced this issue Dec 10, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- /proc/cpuinfo is check _last_
- nproc is checked first (before was not checked at all, it's considered to be more accurate and less convoluted than cpuinfo though)
- not sure about the `return 2`, but this was not too clear [here](phpstan#514 (review)) neither. I could otherwise change the fallback value to return `1` if `proc_open` doesn't exist and 2 otherwise
- add more ways to find the CPU cores count
theofidry added a commit to infection/infection that referenced this issue Dec 11, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- add more ways to detect the CPU core counts
- better handling of failures
ondrejmirtes pushed a commit to phpstan/phpstan-src that referenced this issue Dec 11, 2022
See theofidry/cpu-core-counter#11 for the motivations.

The code should be sensibly the same, the notable differences are:

- fixed the deprecated usage of `hw.ncpu`
- /proc/cpuinfo is check _last_
- nproc is checked first (before was not checked at all, it's considered to be more accurate and less convoluted than cpuinfo though)
- not sure about the `return 2`, but this was not too clear [here](#514 (review)) neither. I could otherwise change the fallback value to return `1` if `proc_open` doesn't exist and 2 otherwise
- add more ways to find the CPU cores count
@theofidry
Copy link
Owner Author

theofidry commented Dec 11, 2022

I think this task served its purpose. If more projects are interested in integrating this library there should be enough examples for it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant