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
Tests the difference in using Array.push, Array.concat, and custom code when needing to add specific known items to an array. Does not cover adding an unknown-length array to an array.
var array = [1];
Array.prototype.cpush = function(item) {
this[this.length] = item;
};
Array.prototype.cpushAll = function() {
var i = 0,
l = this.length;
this.length += arguments.length;
while (l < this.length) {
this[l++] = arguments[i++];
}
};
Ready to run.
Test | Ops/sec | |
---|---|---|
array.push multiple args |
| ready |
array.concat |
| ready |
array.push multiple lines |
| ready |
custom push |
| ready |
array.concat multiple args |
| ready |
custom push function |
| ready |
custom multiple push function |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.