New version is online here: Javascript Webworkers

1) How many Web Workers?

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

2) Test size? Generate n pseudorandom numbers using LCG (info)

This test will run the LCG and generate 2 pseudorandom numbers (, one per Web Worker).

3) Run

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

Results

For better results run the same test more than once.

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 generate a LCG stream of pseudorandom numbers).

Example:
Running 3 Web Workers, using 222 = 4 194 304 as set:
. Web Worker #1 will start the stream with seed 1 and generate 1 398 102 numbers
. Web Worker #2 will start the stream with seed 1 398 103 and generate 1 398 102 numbers
. Web Worker #3 will start the stream with seed 2 796 205 and generate 1 3981 00 numbers

Benchmark

This benchmark will run 40 tests (size: 227) with a variable number of Web Workers: 1, 2, 4 and 8 (it may take a while). Results will show up on the "Results" box.

Benchmark Results

Tested with Firefox 3.5.3 on all computers.

1) Intel Atom N270 1.6 GHz (single core, hyper-threading) - show

Benchmark Group #4 average: 37811 ms, 8 Workers [70%]
Benchmark Group #3 average: 37698 ms, 4 Workers [70%]
Benchmark Group #2 average: 37625 ms, 2 Workers [70%]
Benchmark Group #1 average: 53863 ms, 1 Worker [Standart Test, 100%]

2) AMD Athlon 2650e 1.6 GHz (single core) - show

Benchmark Group #4 average: 23858 ms, 8 Workers [100%]
Benchmark Group #3 average: 23945 ms, 4 Workers [100%]
Benchmark Group #2 average: 24037 ms, 2 Workers [101%]
Benchmark Group #1 average: 23832 ms, 1 Worker [Standart Test, 100%]

3) Intel Core 2 Duo T7200 2.0 GHz (dual core) - show

Benchmark Group #4 average: 7095 ms, 8 Workers [51%]
Benchmark Group #3 average: 7073 ms, 4 Workers [51%]
Benchmark Group #2 average: 7047 ms, 2 Workers [51%]
Benchmark Group #1 average: 13821 ms, 1 Worker [Standart Test, 100%]

4) AMD Phenom X4 9500 2.2 GHz (quad core) - show

Benchmark Group #4 average: 4489 ms, 8 Workers [28%]
Benchmark Group #3 average: 4075 ms, 4 Workers [25%]
Benchmark Group #2 average: 8114 ms, 2 Workers [50%]
Benchmark Group #1 average: 16069 ms, 1 Worker [Standart Test, 100%]

5) Intel Core 2 Quad Q9400 2.66 GHz (quad core) - show

Benchmark Group #4 average: 2839 ms, 8 Workers [26%]
Benchmark Group #3 average: 2890 ms, 4 Workers [27%]
Benchmark Group #2 average: 5535 ms, 2 Workers [51%]
Benchmark Group #1 average: 10849 ms, 1 Worker [Standart Test, 100%]

Source Code

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

Other Browsers

I still have some problemas passing objects on Chrome and Safari. More to come on this subject soon.