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
fix angular foreach call
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.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",
workLogs: [{
id: 'item1',
hours: [5, 3, 6, 2, 1]
}, {
id: 'item2',
hours: [5, 3, 6, 2, 1]
}]
}, {
"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",
workLogs: [{
id: 'item1',
hours: [5, 3, 6, 2, 1]
}, {
id: 'item2',
hours: [5, 3, 6, 2, 1]
}]
}];
angular.forEach(stats, function(dataset) {
angular.forEach(dataset.workLogs, function(workLog) {
angular.forEach(workLog.hours, function(work) {
if (dataset.window && dataset.window === 'lifetime') {
delete dataset.window;
retObj = dataset;
}
});
Ready to run.
Test | Ops/sec | |
---|---|---|
Angular forEach |
| ready |
Native For |
| ready |
Native forEach |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.