Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JSON.parse vs String.substring for fetching one value
is it faster to get one value by JSON.parse() or directly via String.substring
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.parse()
2022833.6 Ops/sec
String.substring
190171232.0 Ops/sec
Script Preparation code:
var ob = `{"aenderungen":[],"_id":"64c0fc4abd2c8bd76c9553f2","name":"Maxis","geburtsdatum":"2023-08-02T00:00:00.000Z","ICD10Code":"k k k k k ","position":0,"empfangsdatum":"2023-07-26T10:58:18.716Z","hinzugefügtVon":"6498bf3b2afb897aa26d18e6","infos":{"berichte":"ggg","puls":"hallo yazn "},"positionarr":[0,0],"stationen":[],"__v":0}`
Tests:
JSON.parse()
var value = JSON.parse(ob)._id;
String.substring
const value = ob.substring(25,49);