4 ms·
js is single threaded. parallel number crunching is not possible. You can fake it by kicking off multiple executions on a data set and chunk the work load acro
by jordache 9y ago
js is single threaded. parallel number crunching is not possible.
You can fake it by kicking off multiple executions on a data set and chunk the work load across the data set, so they progress incrementally and equivalently. The data might be small enough (or browser fast enough) to give the impression of things being done in parallel.
- munchor 9y agoOP referred to Web Workers[1] which do allow real parallel number crunching (at minimum on a different thread, might even be in a different core). It's a somewhat "new" feature of JavaScript but most modern browsers already implement it[2]. [1] https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers... [2] http://caniuse.com/#search=webworkers http://caniuse.com/#search=webworkers
- jordache 9y agodo you read? OP asked for an example sans web workers. Plus web workers do not change the fact that JS is single threaded.