testing out chaining functions

JavaScript performance comparison

Test case created by Andrew Klatzke

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var callbackList = [];
    for( var i; i < 100; i++ ){
       callbackList.push(function(){ return i; })
    }
   
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
for in
for( var x in callbackList ){
  x();
}
pending…
x,n
for( var x = 0, n; n = callbackList[x]; ++x ){
   n();
}
pending…
x
for( var x = 0; x < callbackList.length; x++ ){
   callbackList[x]();
}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment