Number crunching JavaScript. Browser speed comparison
Record execution times of
phase function
JavaScript using the browsers:
Mozilla Firefox, Apple Safari, Internet Explorer, Google Chrome, and Opera.
The input is
an experimental data set of 673 spike times.
Cut and paste all these data points
into the "Give input data-1 below:" box of the JavaScript program window that appears at the bottom of this page.
And click "Get Auto-phase function" and record the "Execution Time" that appears in a text area on the right of the same program window
for various values of "Step" found there. The results are presented as
the
Execution Time vs. the number of steps,
N [= (Maximum-Minimum)/Step].
These parameters are found in the same program window.
The script finds an "auto-phase function" that is similar in character to an auto-correlation function
for discrete samples such as spike times. "Step" controls the output temporal resolution that is sought in
computing that function. The program creates six arrays to store data and then to plot the result.
The size of any of the arrays is not predefined, and grows at every new data point with the push( ) method.
Increasing
N (same as decreasing Step) essentially increases the size of these arrays. A typical script
on a typical website may not have to deal with such big arrays, but such is the nature of this particular
experiment.
These are the results of the single experiment described above, and not
a general/exhaustive test of the speed of the browsers at all.
Firefox, Safari and Chrome were running on Mac OS X 10.5.4 (CPU: 2.8 GHz, Intel Xeon),
Opera was running on GNU/Linux 2.6.31-15-generic (2.33 GHz, Intel Core T7600),
and the Internet Explorer was running on Windows XP (3.06 GHz, Pentium 4).
Results from Firefox were variable (execution times actually increased) if the same
computation was done repeatedly. So its browser was restarted for every computation!
The phase function
computation was done by Chrome
way faster than all the others. Note the log scales on either axis!
For 100 steps, the execution time in any of the browsers is around a second or less (or far less for Chrome).
But for 1000 steps, it's about 1 second in Chrome, about 4 seconds in Safari,
about 17 seconds in Opera, about 27 seconds in Explorer,
and about 8 minutes (!!) in Firefox.
And for executing just one step,
Chrome is 5 times faster than Safari, and
more than 10 times faster than the rest of the browsers.
Update: Another browser Epiphany is tested on the Linux machine, and the results match or beat Chrome's.
The figure is updated.