Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.76
Chrome 116
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
lodash partition 6260.9 Ops/sec
lodash remove 5708.4 Ops/sec
HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
x
 
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) }))
Tests:
  • lodash partition

     
    const [a, b] = _.partition(tabl, e => e.value % 2)
  • lodash remove

     
    const a = _.remove(tabl, e => e.value % 2)
    tabl = [...tabl, ...a]