1) How many Web Workers?

Web Workers (each Web Worker launches a new a thread).

2) Test size? Calculate ab mod m using the Chinese Remainder Theorem (info)

This test will calculate 2 mod 97777 using , one per Web Worker.

3) Run

This may take a while, depending on the size of the test (tests bigger than 22048M may be slow).

Results

For better results run the same test more than once.

Benchmarks

Run

This benchmark will run 50 tests (size: 22048M) with a variable number of Web Workers: 1, 2, 4, 8 and 16 (may take a while).

Results (using Safari 5.0)

1) show - Intel Core i7-860 (2.8 GHz, quad core, HT) [ ark.intel.com ]

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%]

Information

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).

Example:
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).

Source Code

All JavaScript source code is online here (except UI code).

Changelog

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.
Fork me on GitHub