3 ms·
Test case: http://ejohn.org/files/json-parse/ http://ejohn.org/files/json-parse/ Firefox 3.5: eval: 549 JSON.parse: 490 Safari 4: eval: 246 JSON.parse: 215
by jeresig 17y ago
Test case: http://ejohn.org/files/json-parse/ http://ejohn.org/files/json-parse/
Firefox 3.5: eval: 549 JSON.parse: 490
Safari 4: eval: 246 JSON.parse: 215
IE 8: eval: 1438 JSON.parse: 1031
Chrome: eval: 241 JSON.parse: 656
So yeah, a bit faster in Firefox and Safari, much much faster in IE 8 (the one that matters), and oddly slower in Chrome. I'll go out on a limb and blame their lax parsing (they support malformed strings).
In the end though the parsing is a distant second to the improved security: Guaranteeing that eval will never get touched in modern browsers is a huge win from a framework perspective.