Test name | Executions per second |
---|---|
lodash map | 64.2 Ops/sec |
lodash forEach | 41.5 Ops/sec |
native for | 101.2 Ops/sec |
native map | 48.9 Ops/sec |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
var data = Array(1000000).fill({
filtering: true,
mapping: 42
});
const aux = [];
_.map(data, el => {aux.push(el.filtering)});
const aux = [];
_.forEach(data, el => {aux.push(el.filtering)});
const aux = [];
for (let index = 0; index < data.length; index++) {
const el = data[index];
aux.push(el.filtering)
}
const aux = [];
data.map(el => {aux.push(el.filtering)})