Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
eval vs json parse (working) real
(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(data) + ")";
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 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0
Browser/OS:
Firefox 144 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
eval + JSON parse
9.8M/s
direct eval
204/s
View exact numbers
Test name
Executions per second
✓
eval + JSON parse
9,780,606 Ops/sec
direct eval
204 Ops/sec
Related benchmarks
RPC eval vs JSON parse.
JSON.stringify vs structuredClone
JSON.parse vs structuredClone
JSON.stringify vs structuredClone, modifications
JSON.parse vs JSON.stringify 2
JSON parse inside eval
Comments
Confirm delete:
Do you really want to delete benchmark?