Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
spread ... 27409220.0 Ops/sec
slice() 28422100.0 Ops/sec
splice(0) 21805308.0 Ops/sec
concat() 24841174.0 Ops/sec
JSON.parse(JSON.stringify()) 1018335.6 Ops/sec
Custom function 853675.4 Ops/sec
Lodash.cloneDeep() 813804.1 Ops/sec
jQuery.extend(true) 664036.4 Ops/sec
HTML Preparation code:
Tests:
  • spread ...

  • slice()

  • splice(0)

  • concat()

  • JSON.parse(JSON.stringify())

  • Custom function

  • Lodash.cloneDeep()

  • jQuery.extend(true)