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
Check what's better to remove an element from an array
<script>
var a = [], i = 1000;
while (i > 0) {
a.push({v:Math.random(), v1:i})
i--;
}
var fn = function(arr, index){
var len = arr.length;
var new_arr = new Array(len-1);
var i = 0, count = 0;
while(i<len) {
if(i!==index){
new_arr[count] = arr[i];
count++;
}
i++;
}
return new_arr;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
slice |
| ready |
splice |
| ready |
copy function |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.