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
Merge creates a smaller footprint because it loops through the original array and adds the new items. Concat is a built-in Javascript function and should be faster, but has a larger footprint.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
//unmodified array
var baseArray = ["Napoleon"];
//modified arrays
var catArray = [],
merArray = [];
//cache concat prototype for best performance
var concat = Array.prototype.concat;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
concat |
| ready |
merge |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.