Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36
Chrome 99
Windows
Desktop
2 years ago
Test name Executions per second
spread ... 27341326.0 Ops/sec
slice() 29686860.0 Ops/sec
splice(0) 20293126.0 Ops/sec
concat() 27429324.0 Ops/sec
JSON.parse(JSON.stringify()) 993079.1 Ops/sec
Custom function 756587.9 Ops/sec
Lodash.cloneDeep() 684906.3 Ops/sec
jQuery.extend(true) 509342.5 Ops/sec
HTML Preparation code:
Tests:
  • spread ...

  • slice()

  • splice(0)

  • concat()

  • JSON.parse(JSON.stringify())

  • Custom function

  • Lodash.cloneDeep()

  • jQuery.extend(true)