navigator.hardwareConcurrency returns the number of logical cores. In my experiments, the performance stops improving if I have more Web Workers than physical cores. Is there a way to get the number of physical cores?
navigator.hardwareConcurrency returns the number of logical cores. In my experiments, the performance stops improving if I have more Web Workers than physical cores. Is there a way to get the number of physical cores?
I know it's an old question, but for anyone else passing by, you could use WebCPU.
It estimates the number of physical cores in the client:
import {WebCPU} from 'webcpu';
WebCPU.detectCPU().then(result => {
console.log(`Reported Cores: ${result.reportedCores}`);
console.log(`Estimated Idle Cores: ${result.estimatedIdleCores}`);
console.log(`Estimated Physical Cores: ${result.estimatedPhysicalCores}`);
});