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
Is it faster to remove an item from an array (and thus allow the indices to be renumbered) or delete a property from an object. Also, checking deletion from array, but this does not renumber the indices so may not be preferable.
Edit: Changed array and object setup to setup code so that it's accurately tested, increased array and object size to see if any difference to array reordering (splice is faster on older test for me for some reason)
var someArr = [];
var someObj = {};
for (var i = 0; i < 1024; i ++) {
someArr[i] = i;
someObj[i] = i;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Array Splice |
| ready |
Object Delete |
| ready |
Array Delete |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.