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
var a = 1;
var b = 2.15923;
var c = 0xFFFFFF | 0;
var d = 'asdf';
var e = 'i should be undefined';
function MapStruct() {
this[a] = a;
this[b] = b;
this[c] = c;
this[d] = d;
};
var obj = {};
obj[a] = a;
obj[b] = b;
obj[c] = c;
obj[d] = d;
var map = new Map();
map.set(a, a);
map.set(b, b);
map.set(c, c);
map.set(d, d);
var struct = new MapStruct();
var array = [a, b, c, d]
, lookup = { a: 0, b: 1, c: 2, d: 3 }
function Datum(a, b, c, d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
}
var datum = new Datum(a, b, c, d)
, frozen = Object.freeze(new Datum(a, b, c, d))
var aSymbol = Symbol()
, bSymbol = Symbol()
, cSymbol = Symbol()
, dSymbol = Symbol()
, eSymbol = Symbol()
var symbolic = {
[aSymbol]: a,
[bSymbol]: b,
[cSymbol]: c,
[dSymbol]: d
}
Ready to run.
Test | Ops/sec | |
---|---|---|
obj property lookup |
| ready |
struct property lookup |
| ready |
map lookup 1 |
| ready |
array with index lookup |
| ready |
data object wrapper |
| ready |
frozen datum |
| ready |
symbolic datum |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.