Paroles

JavaScript performance comparison

Revision 4 of this test case created by JeanHuguesRobert

Info

Compare some Promise/A implementation.

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 src="https://github.com/JeanHuguesRobert/l8/raw/master/lib/whisper.js"></script>


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

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Q
var d = Q.defer();
d.promise.then(addOne).then(addOne);
d.resolve(1);
pending…
when
var d = when.defer();
d.promise.then(addOne).then(addOne);
d.resolve(1);
pending…
P
var d = P.defer();
d.promise.then(addOne).then(addOne);
d.resolve(1);
pending…
Parole
var p = Parole();
p.then( addOne ).then(addOne);
p( null, 1 );
pending…
Parole bis
var p = Parole();
p.then( addOne ).then(addOne);
p.resolve( 1 );
pending…
Parole Q
var p = Parole.Q.defer();
p.promise.then( addOne ).then(addOne);
p.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. Here’s a list of current revisions for this page:

0 comments

Add a comment