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
Trying to comare all available Array assignment methods
<script>
var arr = [];
var func = function() {};
var obj = {};
var x = 10;
var array_max_length = 10000; //10k
/*
Please do not use unshift for big arrays it's to long to move all values after first, I'm trying with 1kk and 10kk in Ghrome, but it's very time consumable
*/
var for_iteration_count = array_max_length / 4;
function start(a) {
arr = [];
for_function(a);
}
function for_function(a) {
for (var i = for_iteration_count; i; i--) {
a();
}
}
function do10kkPush() {
var n = [];
for (var i = 10000000; i; i--) {
n.push(10);
};
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
push |
| ready |
empty brackets |
| ready |
unshift |
| ready |
concat |
| ready |
array_length |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.