HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'>
3
const _ = lodash
4
</script>
Tests:
  • lodash cloneDeep

     
    _.cloneDeep({ prop: { subprop: 'value' } })
  • my super deep cloner yeah

     
    const trueclone = (obj) => {
        const cloned = Array.isArray(obj) ? [] : {}
        const keys = Object.keys(obj)
        const values = Object.values(obj)
        const length = keys.length
        for (let i = 0; i < length; i++) {
            if (typeof values[i] === 'object') values[i] = trueclone(values[i])
            cloned[keys[i]] = values[i]
        }
        return cloned
    }
    trueclone({ prop: { subprop: 'value' } })
  • structuredClone

     
    structuredClone({ prop: { subprop: 'value' } })
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    lodash cloneDeep
    my super deep cloner yeah
    structuredClone

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Chrome 103 on Windows
View result in a separate tab
Test name Executions per second
lodash cloneDeep 980598.2 Ops/sec
my super deep cloner yeah 846712.8 Ops/sec
structuredClone 403174.0 Ops/sec