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
_.foreach uses while loop, angular.forEach uses native forEach iterator if possible, otherwise uses for loop
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
var dataset, i, retObj = {}, stats = [{
"window": "lifetime",
"source": "DX",
"spend": "1642.81",
"ideal_spend": "2989.86",
"pace": "43",
"impressions": "224929",
"actions": "189",
"cpm": "3.90",
"ideal_cpm": "2.81",
"cpa": "25.82"
}, {
"window": "yesterday",
"source": "DX",
"spend": "1634.57",
"ideal_spend": "3276.75",
"pace": "24",
"impressions": "24771",
"actions": "41",
"cpm": "2.08",
"ideal_cpm": "3.14",
"cpa": "16.00"
}];
for (var i=0; i<500; i++) {
stats.push(stats[0]);
}
var callback = function(dataset, key){
if (dataset.window && dataset.window === 'lifetime') {
delete dataset.window;
retObj = dataset;
}
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Angular forEach |
| ready |
Native For |
| ready |
Native While |
| ready |
Lo-Dash _.each |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.