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 ... 42651072.0 Ops/sec
slice() 44981264.0 Ops/sec
splice(0) 32591598.0 Ops/sec
concat() 40365376.0 Ops/sec
JSON.parse(JSON.stringify()) 1142421.4 Ops/sec
Custom function 1033725.1 Ops/sec
Lodash.cloneDeep() 938950.2 Ops/sec
jQuery.extend(true) 711765.5 Ops/sec
HTML Preparation code:
Tests:
  • spread ...

  • slice()

  • splice(0)

  • concat()

  • JSON.parse(JSON.stringify())

  • Custom function

  • Lodash.cloneDeep()

  • jQuery.extend(true)