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
Going through each element of an array. Testing the performance of different methods.
Based on this set of tests: http://jsperf.com/for-vs-foreach/159
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<!-- Underscore -->
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">
</script>
<script>
var underscore = _.noConflict();
</script>
<!-- LoDash -->
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js">
</script>
<script>
var lodash = _.noConflict();
</script>
<!-- Lazy.js -->
<script src='//rawgithub.com/dtao/lazy.js/master/lazy.js'>
</script>
<!-- End preparation -->
var i,
value,
length,
values = [],
sum = 0,
context = values;
for (i = 0; i < 10000; i++) {
values[i] = Math.random();
}
i = 0;
value = 0;
length = 0;
values = [];
sum = 0;
Ready to run.
Test | Ops/sec | |
---|---|---|
Native for |
| ready |
Native forEach |
| ready |
Native for, reverse |
| ready |
jQuery each |
| ready |
Underscore each |
| ready |
Lodash each |
| ready |
Lazy each |
| ready |
Native while |
| ready |
Native while edit |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.