wqfwewefewrw

JavaScript performance comparison

Test case created by done

Preparation code

<script src="https://github.com/kriskowal/q/raw/master/q.js"></script>
<script src="https://github.com/rkatic/p/raw/master/p.js"></script>
    <script>
        define = function( factory ) {
            when = factory();
        };
        define.amd = {};
    </script>
<script src="https://github.com/cujojs/when/raw/master/when.js"></script>



      
<script>
Benchmark.prototype.setup = function() {
  function addOne(x) {
  	return x + 1;
  }

};
</script>

Preparation code output

<script src="https://github.com/rkatic/p/raw/master/p.js"></script> <script> define = function( factory ) { when = factory(); }; define.amd = {}; </script> <script src="https://github.com/cujojs/when/raw/master/when.js"></script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Q
var d = Q.defer();
d.promise.then(addOne);
d.resolve(1);
pending…
when
var d = when.defer();
d.promise.then(addOne);
d.resolve(1);
pending…
P
var d = P.defer();
d.promise.then(addOne);
d.resolve(1);
pending…
P - done
var d = P.defer();
d.promise.done(addOne);
d.resolve(1);
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.

0 Comments