Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
deepmerge vs structuredClone
(version: 1)
deepmerge vs structuredClone
Comparing performance of:
Lib deepmerge vs Native structuredClone
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/deepmerge@4.3.1/dist/umd.min.js"></script>
Script Preparation code:
const testRules = [ { every: { specific: { daysOfWeek: ['Sun', 'Mon', 'Tue', 'Thu', 'Fri', 'Sat'], reference: 'Noon', offset: { value: { integer: 10, }, unit: 'Minute', }, }, actions: [ { if: { and: [ { not: { equals: { left: { date: { daysOfWeek: ['Sun', 'Sat'], }, }, right: { date: { reference: 'Today', }, }, aggregation: 'Any', changesOnly: false, }, }, }, { equals: { left: { location: { locationId: '1f6ef2d1-a5f1-44b9-b01a-cb715904bc3a', postalCode: '55455', attribute: 'WeatherAlertSeverity', trigger: 'Never', }, }, right: { array: { operands: [ { string: 'Extreme', }, { string: 'Severe', }, { string: 'Moderate', }, ], }, }, aggregation: 'Any', changesOnly: false, }, }, { or: [ { equals: { left: { device: { devices: ['06b0d7a8-7849-4582-bf18-39efd0d03197'], component: 'main', capability: 'switch', attribute: 'switch', trigger: 'Always', }, }, right: { string: 'on', }, aggregation: 'Any', changesOnly: false, }, }, { changes: { equals: { left: { device: { devices: ['06b0d7a8-7849-4582-bf18-39efd0d03197'], component: 'main', capability: 'switch', attribute: 'switch', trigger: 'Always', }, }, right: { string: 'off', }, aggregation: 'Any', changesOnly: false, }, }, }, { equals: { left: { location: { locationId: '1f6ef2d1-a5f1-44b9-b01a-cb715904bc3a', attribute: 'Mode', trigger: 'Always', }, }, right: { array: { operands: [ { string: 'f6be37da-7454-409c-a9d8-1373558390a1', }, ], }, }, aggregation: 'Any', changesOnly: false, }, }, { equals: { left: { location: { locationId: '1f6ef2d1-a5f1-44b9-b01a-cb715904bc3a', attribute: 'Security', trigger: 'Always', }, }, right: { string: 'Disarmed', }, aggregation: 'Any', changesOnly: false, }, }, { between: { value: { device: { devices: ['0ca5e23e-ef18-4a10-831e-35c9eb42fd0f'], component: 'main', capability: 'switchLevel', attribute: 'level', trigger: 'Always', }, }, start: { decimal: 0, }, end: { decimal: 950, }, aggregation: 'Any', changesOnly: true, }, }, ], }, ], then: [ { command: { devices: ['6fb6f75a-196e-43f1-8468-429b0a37ef06'], commands: [ { component: 'main', capability: 'switch', command: 'on', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, { location: { locationId: '1f6ef2d1-a5f1-44b9-b01a-cb715904bc3a', mode: 'b58852e5-1f01-4930-ad7c-c24d7b1ba695', }, }, { command: { devices: ['ac31f98a-160d-4da8-968a-7a3524b3d471'], commands: [ { component: 'main', capability: 'switch', command: 'off', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, { sleep: { duration: { value: { integer: 20, }, unit: 'Second', }, }, }, { command: { devices: ['0ca5e23e-ef18-4a10-831e-35c9eb42fd0f'], commands: [ { component: 'main', capability: 'switchLevel', command: 'setLevel', arguments: [ { integer: 50, }, ], }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], else: [ { command: { devices: ['2d874184-1ebe-4492-8668-cd9695bd31e5'], commands: [ { component: 'main', capability: 'switch', command: 'on', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], sequence: { then: 'Parallel', else: 'Serial', }, }, }, { if: { equals: { left: { date: { daysOfWeek: ['Sun', 'Mon', 'Tue'], }, }, right: { date: { reference: 'Today', }, }, aggregation: 'Any', changesOnly: false, }, then: [ { command: { devices: ['2d874184-1ebe-4492-8668-cd9695bd31e5'], commands: [ { component: 'main', capability: 'switch', command: 'on', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, { if: { equals: { left: { device: { devices: ['2d874184-1ebe-4492-8668-cd9695bd31e5'], component: 'main', capability: 'switch', attribute: 'switch', trigger: 'Always', }, }, right: { string: 'off', }, aggregation: 'Any', changesOnly: false, }, then: [ { command: { devices: ['2d874184-1ebe-4492-8668-cd9695bd31e5'], commands: [ { component: 'main', capability: 'switch', command: 'on', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], else: [ { command: { devices: ['2d874184-1ebe-4492-8668-cd9695bd31e5'], commands: [ { component: 'main', capability: 'switch', command: 'off', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], }, }, ], else: [ { command: { devices: ['eee19d1d-c6ca-4fd7-aee7-310e43971837'], commands: [ { component: 'main', capability: 'switch', command: 'off', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, { if: { equals: { left: { device: { devices: ['eee19d1d-c6ca-4fd7-aee7-310e43971837'], component: 'main', capability: 'switch', attribute: 'switch', trigger: 'Always', }, }, right: { string: 'off', }, aggregation: 'Any', changesOnly: false, }, then: [ { command: { devices: ['eee19d1d-c6ca-4fd7-aee7-310e43971837'], commands: [ { component: 'main', capability: 'switch', command: 'on', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], else: [ { command: { devices: ['4f587682-0de2-4e91-8f34-e5a99c909cb2'], commands: [ { component: 'main', capability: 'switch', command: 'off', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], }, }, ], }, }, { command: { devices: ['4f587682-0de2-4e91-8f34-e5a99c909cb2'], commands: [ { component: 'main', capability: 'switch', command: 'on', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], }, }, { every: { specific: { daysOfWeek: ['Mon', 'Tue', 'Thu'], reference: 'Noon', offset: { value: { integer: 10, }, unit: 'Minute', }, }, actions: [ { command: { devices: ['a7aaa421-1976-4999-8d89-f7b187eb1322'], commands: [ { component: 'main', capability: 'switch', command: 'on', }, ], sequence: { commands: 'Serial', devices: 'Serial', }, }, }, ], }, }, ]; let myCopy;
Tests:
Lib deepmerge
myCopy = deepmerge(testRules, []);
Native structuredClone
myCopy = structuredClone(testRules);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lib deepmerge
Native structuredClone
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser/OS:
Chrome 133 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lib deepmerge
12763.1 Ops/sec
Native structuredClone
12575.3 Ops/sec
Related benchmarks:
Lodash isEqual object array test to use in mnp2
Updating objects
Updating objects w spread
object.create vs _.clone
Updating objects 2
ramda vs lodash.merge vs deepmerge
new set vs find
Object access method
lodash merge vs deepmerge vs deepmerge-ts vs @fastify/deepmerge vs just-extend (take 3)
Comments
Confirm delete:
Do you really want to delete benchmark?