Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
json stringify vs array tostring - complex structures
Tests performance of Array.toString vs JSON.stringify for complex structures (array of objects as opposed to array of primitive types)
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/17.3.1 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
toString
411423.6 Ops/sec
JSON.stringify
210478.1 Ops/sec
Script Preparation code:
function moreData(arr, left) { if(left === 0) return arr; else { arr.push({ data: { properties: { string: "value", parameter: Math.floor(Math.random() * 256) }, embeddedArray: new Array(Math.floor(Math.random() * 100)).fill(0) } }); return moreData(arr, left - 1); } } function makeTestData() { return moreData([], 4); }
Tests:
toString
makeTestData().toString()
JSON.stringify
JSON.stringify(makeTestData());