Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
spread ... 9490254.0 Ops/sec
slice() 10030971.0 Ops/sec
splice(0) 7710563.0 Ops/sec
concat() 8932440.0 Ops/sec
JSON.parse(JSON.stringify()) 549580.1 Ops/sec
Custom function 412959.5 Ops/sec
Lodash.cloneDeep() 370839.0 Ops/sec
jQuery.extend(true) 253472.5 Ops/sec
HTML Preparation code:
Tests:
  • spread ...

  • slice()

  • splice(0)

  • concat()

  • JSON.parse(JSON.stringify())

  • Custom function

  • Lodash.cloneDeep()

  • jQuery.extend(true)