HTML Preparation code:
Tests:

Historical Performance Data aggregated from 5 community runs

Desktop Results:
Chrome 5 runs
Spread operator (...)
3K/s
jQuery.extend(true)
3K/s
Lodash.cloneDeep()
3K/s
structuredClone()
1K/s
Custom function
23/s
JSON.parse(JSON.stringify())
15/s

Fastest: Spread operator (...) (208.4x faster)

View exact numbers
  • Spread operator (...): 3,160 ops/sec
  • jQuery.extend(true): 2,906 ops/sec
  • Lodash.cloneDeep(): 2,667 ops/sec
  • structuredClone(): 1,408 ops/sec
  • Custom function: 23 ops/sec
  • JSON.parse(JSON.stringify()): 15 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Spread operator (...)
    JSON.parse(JSON.stringify())
    Custom function
    Lodash.cloneDeep()
    jQuery.extend(true)
    structuredClone()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Chrome 139 on Windows
View result in a separate tab
jQuery.extend(true)
4K/s
Spread operator (...)
4K/s
Lodash.cloneDeep()
4K/s
structuredClone()
2K/s
Custom function
45/s
JSON.parse(JSON.stringify())
20/s
View exact numbers
Test name Executions per second
jQuery.extend(true) 3,830 Ops/sec
Spread operator (...) 3,676 Ops/sec
Lodash.cloneDeep() 3,651 Ops/sec
structuredClone() 1,867 Ops/sec
Custom function 45 Ops/sec
JSON.parse(JSON.stringify()) 20 Ops/sec