Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
structuredClone vs Immer vs JSON.parse/stringify
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.3 Safari/605.1.15
Browser:
Safari 26
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 months ago
Test name
Executions per second
produce
1283775.1 Ops/sec
structuredClone
954352.1 Ops/sec
JSON back and forth
1524641.0 Ops/sec
HTML Preparation code:
<script type="module"> import { produce } from 'https://cdn.jsdelivr.net/npm/immer@10.1.1/+esm'; window.immerProduce = produce; </script> <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/uuid@10.0.0/dist/index.min.js"></script>
Script Preparation code:
const numSiblings = 500; const depth = 3; state = { field: 'f1', operator: '=', value: 'v1' };
Tests:
produce
const result = immerProduce(state, draft => { draft.id = crypto.randomUUID(); }); console.log(result);
structuredClone
const result = structuredClone(state); result.id = crypto.randomUUID(); console.log(result);
JSON back and forth
const result = JSON.parse(JSON.stringify({ ...state, id: crypto.randomUUID() })); console.log(result);