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 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Browser:
Firefox 115
Operating system:
Windows 7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
JSON.parse()
591218.8 Ops/sec
String.substring
113683104.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);