ralscha/bread-compressor-cli

Concurrency option doesn't seem to work

Closed this issue · 1 comments

I'm seeing single-core utilization only, even when providing the -l 4 argument.

Any ideas?

The cli uses (promise-limit)[https://github.com/featurist/promise-limit] to limit the number of promises.
As far as I know Node.js is by default single threaded, similar to a browser.

To leverage multiple cores we should look at https://nodejs.org/api/cluster.html and WebWorkers.
From the Cluster documentation
"A single instance of Node.js runs in a single thread. To take advantage of multi-core systems, the user will sometimes want to launch a cluster of Node.js processes to handle the load."