JSON Parsing

JavaScript performance comparison

Revision 4 of this test case created by Kyle Simpson

Preparation code

<script>
  var myjson = '{"mylist": [4, 8, 15, 16, 23, 42], "myobject": {"hello": "world"}, "myint": 23, "mystrlist": ["foo", "bar"]}',
      cachedEval = eval('(' + myjson + ')'),
      cachedFunction = (new Function('return ' + myjson));
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Evil
eval('(' + myjson + ')');
pending…
JSON.parse
JSON.parse(myjson);
pending…
New Function Parse
(new Function('return ' + myjson))();
pending…
Cached Function
cachedFunction();
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment