jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
A comparison of the two most highly performant promise implementations and the new native promises.
<script src="http://rsvpjs-builds.s3.amazonaws.com/rsvp-latest.js"></script>
<script src="https://rawgithub.com/petkaantonov/bluebird/master/js/browser/bluebird.js"></script>
<script>var BPromise = Promise.noConflict();
if ((Promise + "").indexOf("native") < 0) alert("not native promises");
</script>
<script>
function P(fn) {
var state = 'pending';
var value;
var deferred = null;
function resolve(newValue) {
value = newValue;
state = 'resolved';
if(deferred) {
handle(deferred);
}
}
function handle(handler) {
if(state === 'pending') {
deferred = handler;
return;
}
if(!handler.onResolved) {
handler.resolve(value);
return;
}
var ret = handler.onResolved(value);
handler.resolve(ret);
}
this.then = function(onResolved) {
return new P(function(resolve) {
handle({
onResolved: onResolved,
resolve: resolve
});
});
};
fn(resolve);
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Bluebird deferred |
| ready |
RSVP deferred |
| ready |
Bluebird classic |
| ready |
RSVP classic |
| ready |
Native Promises |
| ready |
My Promise |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.