Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Reduce-based serialize vs JSON serialize
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Browser:
Chrome 146
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one month ago
Test name
Executions per second
JSON serialize
2895620.0 Ops/sec
Reduce serialize
4270713.0 Ops/sec
Script Preparation code:
window.address = [{ 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.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.address)
Reduce serialize
serializeAddressReduce(window.address)