Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27
Chrome 105
Windows
Desktop
2 years ago
Test name Executions per second
spread ... 34520368.0 Ops/sec
slice() 37682400.0 Ops/sec
splice(0) 29838642.0 Ops/sec
concat() 35413152.0 Ops/sec
JSON.parse(JSON.stringify()) 1323889.4 Ops/sec
Custom function 1108957.1 Ops/sec
Lodash.cloneDeep() 1036646.9 Ops/sec
jQuery.extend(true) 817786.2 Ops/sec
HTML Preparation code:
Tests:
  • spread ...

  • slice()

  • splice(0)

  • concat()

  • JSON.parse(JSON.stringify())

  • Custom function

  • Lodash.cloneDeep()

  • jQuery.extend(true)