1) How many Web Workers?
2) Test size? Calculate
m using the Chinese Remainder Theorem (info)
3) RunThis may take a while, depending on the size of the test (tests bigger than 22048M may be slow).
ResultsFor better results run the same test more than once.
Results (using Safari 5.0)
1) ark.intel.com ]- Intel Core i7-860 (2.8 GHz, quad core, HT) [
Benchmark Group #5 average: 3325 ms, 16 Workers [16%]
Benchmark Group #4 average: 3338 ms, 8 Workers [16%]
Benchmark Group #3 average: 6054 ms, 4 Workers [29%]
Benchmark Group #2 average: 10920 ms, 2 Workers [52%]
Benchmark Group #1 average: 20836 ms, 1 Worker [Standart Test, 100%]
How it Works
This example is quite simple: it launches
n Web Workers (threads) and each one verifies a portion of the problem set (in this case, each Web Worker computes part of ab mod c).
Running 3 Web Workers, using
210 mod 7 as the problem:
. Web Worker #1 will compute 24 mod 7;
. Web Worker #2 will compute 23 mod 7;
. Web Worker #3 will compute 23 mod 7.
In the end the main thread will use all three results and compute the final one. This can be seen as a map/reduce problem (info).
- v1.4.0 (21/Jun/2010)
- New algorithm (ab mod c). This new algorithm truly uses multiple cores to achive one single result.
- v1.3.1 (07/Mar/2010)
- This version is now compatible with: Firefox 3.5+ (3.6 and 3.7), Google Chrome 4+ (5 dev) and Safari 4.0.4+.
- v1.3.0 (17/Oct/2009)
- First public release, only compatible with Firefox.
- Mozilla Developer Center - Using web workers
- Web Tech Blog - Web Workers, Part 1
- Web Tech Blog - Web Workers, Part 2
- Web Tech Blog - Web Workers, Part 3
- Elijah Grey jsandbox (jsandbox.js)
- Choosing a DOCTYPE
- JQuery User Interface
- Wikipedia - Chinese Remainder Theorem
- Wikipedia - Thread
- Wikipedia - Map Reduce