Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Reduce serialize vs JSON serialize
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
JSON serialize
1423722.4 Ops/sec
Reduce serialize
2802268.2 Ops/sec
Script Preparation code:
window.address1 = [{ childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }]; window.address2 = [{ childrenIndex: 1 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }, { childrenIndex: 0 }, { toggleIndex: 1 }, { instanceIndex: 2 }]; window.serializeAddressJSON = (address) => JSON.stringify(address); window.serializeAddressReduce = (address) => address.reduce((serialized, point) => { const { childrenIndex, toggleIndex, instanceIndex } = point; let pointCode; if (childrenIndex !== undefined) { pointCode = `c${childrenIndex}`; } if (toggleIndex !== undefined) { pointCode = `t${toggleIndex}`; } if (instanceIndex !== undefined) { pointCode = `i${instanceIndex}`; } return `${serialized}${pointCode}`; }, '');
Tests:
JSON serialize
serializeAddressJSON(window.address1, window.address2)
Reduce serialize
serializeAddressReduce(window.address1, window.address2)