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:
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(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:
6 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
Test name
Executions per second
direct eval
203.7 Ops/sec
eval + JSON parse
9780606.0 Ops/sec
Related benchmarks:
RPC eval vs JSON parse.
Object.assign vs JSON Clone
JSON.stringify vs structuredClone
Test of JSON Stringify vs. structuredClone
JSON.parse(JSON.stringify( vs structuredClone( FIXED
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?