Reputation: 81
Suppose you have a task on your webapp that demands maximum performance. The task is highly parallelizable: you can subdivide it on, say, 500 independent subtasks. What is the best solution?
If (B) is the way to go, how can you determine (empirically if needed) the best value for t? Is there any library to solve this particular problem?
Upvotes: 6
Views: 3641
Reputation: 18435
Use navigator.hardwareConcurrency for optimal number of web workers.
Browser support - http://caniuse.com/#search=hardwareConcurrency
Polyfill for non-supported browser versions - https://oswg.oftn.org/projects/core-estimator/demo/
Upvotes: 8