Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15
Safari 17
Mac OS X 10.15.7
Desktop
7 months ago
Test name Executions per second
spread ... 32335646.0 Ops/sec
slice() 27555426.0 Ops/sec
splice(0) 17542796.0 Ops/sec
concat() 13210976.0 Ops/sec
JSON.parse(JSON.stringify()) 1983264.4 Ops/sec
Custom function 1777911.0 Ops/sec
Lodash.cloneDeep() 1851192.4 Ops/sec
jQuery.extend(true) 1270864.6 Ops/sec
HTML Preparation code:
Tests:
  • spread ...

  • slice()

  • splice(0)

  • concat()

  • JSON.parse(JSON.stringify())

  • Custom function

  • Lodash.cloneDeep()

  • jQuery.extend(true)