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 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0
Browser:
Firefox 140
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one month ago
toString
879K/s
JSON.stringify
191K/s
View exact numbers
Test name
Executions per second
✓
toString
878,838 Ops/sec
JSON.stringify
191,429 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());