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:
10 months ago
by:
Guest
Go 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:
10 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
eval + JSON parse
818/s
direct eval
176/s
View exact numbers
Test name
Executions per second
✓
eval + JSON parse
818 Ops/sec
direct eval
176 Ops/sec
Related benchmarks
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?