This test worth only what is worth as it only execute a very limited subset of the JavaScript language, but it should give us a first indication.
This is my first test, I will replace the test code with something more demanding in the future.
First the source code
function print(s){
var oldValue = jQuery("#Output").val();
oldValue += "\r\n" + s;
jQuery("#Output").val(oldValue);
}
function Fibonnaci(n){
var previous = -1;
var result = 1;
for(var i=0; i < n+1; i++){
var sum = result + previous;
previous = result;
result = sum;
}
return result;
}
function Test() {
try {
print("Running...");
var startTime = new Date().getTime();
for (var t = 0; t < 1000; t++) {
for (var i = 0; i < 1000; i++) {
var v = Fibonnaci(i);
}
}
var endTime = new Date().getTime();
var time = (endTime - startTime)/1000;
print("Duration:" + time);
}
catch (ex) {
alert(ex);
}
}
Here is the result in seconds.
| Browser | Execution Time | Performance Compared To Chrome |
| IE 9 | 7.3 | 9.1 slower |
| Safari 5 | 4.3 | 5.4 slower |
| Opera 11 | 4.5 | 5.6 slower |
| Firefox 4 | 3.6 | 4.5 slower |
| Chrome 10 | 0.8 | same |

No comments:
Post a Comment