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>
//unmodified array
var baseArray = ["Napoleon", "Bonaparte", "was", "exiled", "to", "the", "island", "of", "elba", "in", "1813"];
//modified arrays
var catArray = [],
merArray = [],
forArray = []
var x, _i, _len;
Ready to run.
Test | Ops/sec | |
---|---|---|
concat |
| ready |
merge |
| ready |
Coffeescript list comprehension push |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.