Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
structuredClone vs Immer Produce simple
(version: 0)
Comparing performance of:
immer.produce() vs structuredClone
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/immer@3.1.3/dist/immer.umd.min.js"></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script> <script src="https://cdn.jsdelivr.net/npm/uuid@8.3.2/dist/umd/uuidv4.min.js"></script>
Script Preparation code:
const numSiblings = 500; const depth = 3; state = { data: { data1: { data2: 'test', siblings: Array.from({ length: numSiblings }).map(() => ({ id: uuidv4() })), children: Array.from({ length: depth }).map(() => ({ id: uuidv4(), data: { data1: { data2: 'test', siblings: Array.from({ length: numSiblings }).map(() => ({ id: uuidv4() })), children: Array.from({ length: depth }).map(() => ({ id: uuidv4(), data: { data1: { data2: 'test', siblings: Array.from({ length: numSiblings }).map(() => ({ id: uuidv4() })), children: Array.from({ length: depth }).map(() => ({ id: uuidv4(), data: { data1: { data2: 'test', siblings: Array.from({ length: numSiblings }).map(() => ({ id: uuidv4() })), }, }, })), }, }, })), }, }, })), }, data3: Array.from({ length: 1000 }).map(() => ({})), }, };
Tests:
immer.produce()
const result = immer.produce(state, draft => draft)
structuredClone
const result = structuredClone(state);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
immer.produce()
structuredClone
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36
Browser/OS:
Chrome Mobile 141 on Android
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
immer.produce()
2372602.8 Ops/sec
structuredClone
72.4 Ops/sec
Related benchmarks:
TestPerf
TestsPerf
TestsPerf2
PerfTest
TestsPerf21
Lodash CloneDeep vs Immer Produce with heavy load, slightly less useless
structuredClone vs Immer Produce
Immer produce() vs Lodash cloneDeep() vs AngularJS copy() vs JSON.parse()
structuredClone vs Immer
Comments
Confirm delete:
Do you really want to delete benchmark?