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
Object properties vs Array index
var size = 16384;
var typed = new Int32Array(size);
crypto.getRandomValues(typed);
var acc = 0;
var retrieveProp = (x) => ({
a: typed[x],
b: typed[x+1],
c: typed[x+2],
d: typed[x+3],
});
var retrieveArray = (x) => ([
typed[x],
typed[x+1],
typed[x+2],
typed[x+3],
]);
var argBuff = new Int32Array(4);
var retrieveTyped = (x, arr) => {
arr[0] = typed[x];
arr[1] = typed[x+1];
arr[2] = typed[x+2];
arr[3] = typed[x+3];
};
Ready to run.
Test | Ops/sec | |
---|---|---|
object property |
| ready |
array index |
| ready |
typed arg buffer |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.