to select opCode
number of runs to measure (default is none for benchmode 0, 1000 for benchmode 1 and 500 for benchmode 2)


A message box will display the number of milliseconds taken when the number of runs is reached. Keep in mind that each non-blocking run adds a 16ms delay with setTimeout.

The result is just the total time, not a median. If you want to get a usable result, your best bet is running the benchmark multiple times and calculating the median yourself.

Results (Smaller is better)

Firefox Trunk/20100802:

Firefox is fastest with pure processing (by a wide margin), but has problems with too many function calls and doesn't use the 16ms pause quite as well as Opera.

switch/1:1196ms switch/2:8470ms callback/1:3620ms callback/2:10108ms

Chrome 6.0.472.14 dev:

Chrome is slower than Firefox, but still a lot faster than Opera. However, it's totally incapable of making good use of the 16ms pause.

switch/1:2787ms switch/2:9669ms callback/1:3279ms callback/2:10514ms

Opera 10.60:

Opera does very well using the 16ms between runs, but is otherwise slow.

switch/1:7790ms switch/2:8284ms callback/1:8976ms callback/2:9942ms


The source may be used under the AGPL 3.0. You can find the init sequence right in the source of this page, the VM in vms.js and the sample program in program.js.