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
function helloOrNull() {
if (Math.random() > 0.5) {
return null;
} else {
return "hello";
}
}
function Opt(value) {
this.value = value;
};
Opt.prototype.isDefined = function() {
return !!this.value;
};
Opt.prototype.map = function(fn) {
if (this.isDefined()) {
return new Opt(fn(this.value));
} else {
return this;
}
};
Opt.prototype.flatMap = function(fn) {
if (this.isDefined()) {
return fn(this.value);
} else {
return this;
}
};
Opt.prototype.getOrElse = function(fn) {
if (this.isDefined()) {
return this.value;
} else {
return fn();
}
};
function helloOpt() {
if (Math.random() > 0.5) {
return new Opt(null);
} else {
return new Opt("hello");
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
null |
| ready |
Option |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.