Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
spread ... 23811930.0 Ops/sec
slice() 23258348.0 Ops/sec
splice(0) 19175240.0 Ops/sec
concat() 20426700.0 Ops/sec
JSON.parse(JSON.stringify()) 1004481.5 Ops/sec
Custom function 646710.5 Ops/sec
Lodash.cloneDeep() 731345.4 Ops/sec
jQuery.extend(true) 529859.4 Ops/sec
HTML Preparation code:
Tests:
  • spread ...

  • slice()

  • splice(0)

  • concat()

  • JSON.parse(JSON.stringify())

  • Custom function

  • Lodash.cloneDeep()

  • jQuery.extend(true)