Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JSON parse inside eval
(version: 1)
Comparing performance of:
direct eval vs eval + JSON parse
Created:
6 months ago
by:
Guest
Jump to the latest result
Script Preparation code:
var jsonObj = (() => { let data = []; for (let i = 0; i < 10000; ++i) { data.push({k1: i, k2: i * 2, k3: i * 3}); } return JSON.stringify(data); })(); var code1 = "var res1 = " + jsonObj; var code2 = "var res2 = JSON.parse(" + JSON.stringify(jsonObj) + ")";
Tests:
direct eval
eval(code1);
eval + JSON parse
eval(code2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
direct eval
eval + JSON parse
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Android 15; Mobile; rv:143.0) Gecko/143.0 Firefox/143.0
Browser/OS:
Firefox Mobile 143 on Android
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
direct eval
176.1 Ops/sec
eval + JSON parse
817.6 Ops/sec
Related benchmarks:
eval vs new Function 2
Object.assign vs JSON Clone
JSON.stringify vs structuredClone
TestDeepCopy1
Test of JSON Stringify vs. structuredClone
JSON.parse vs structuredClone
JSON.stringify vs structuredClone, modifications
JSON.parse vs JSON.stringify 2
eval vs json parse (working) real
Comments
Confirm delete:
Do you really want to delete benchmark?