Test name | Executions per second |
---|---|
lodash partition | 6260.9 Ops/sec |
lodash remove | 5708.4 Ops/sec |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
var tabl = Array.from({ length: 10000 }).map((value, i) => ({ id: i, value: randomIntFromInterval(0, i) }))
const [a, b] = _.partition(tabl, e => e.value % 2)
const a = _.remove(tabl, e => e.value % 2)
tabl = [tabl, a]