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).
ab
mod m
using the Chinese Remainder Theorem (info)
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%]
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).
All JavaScript source code is online here (except UI code).