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
<script>
var things = [
void 0, null, 123, "456", ["a", "b", "c", "d", "e"],
{
a: "b",
c: "d",
e: "f"
}];
function instanceof1() {
var types = [];
for (var i, len = things.length; i < len; i++) {
types[i] = things[i] instanceof Object;
}
}
function instanceof2() {
var types = [],
O = Object;
for (var i, len = things.length; i < len; i++) {
types[i] = things[i] instanceof O;
}
}
function typeof2() {
var types = [];
for (var i, len = things.length; i < len; i++) {
var value = things[i];
types[i] = typeof value === "object" && value !== null;
}
}
function typeof1() {
var types = [];
for (var i, len = things.length; i < len; i++) {
var value = things[i];
types[i] = value !== null && typeof value === "object";
}
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
typeof |
| ready |
typeof2 |
| ready |
instanceof |
| ready |
instanceof2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.