eval vs json.parse #3 (v3)

Revision 3 of this benchmark created by Richard Green on


Description

Factor out the JSON object lookup into a jp variable.

Preparation HTML

<script>
  var r;
  var jp = JSON.parse;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
eval
r = eval('({"name":"George", "age":29, "friends":["John", "Sarah", "Albert"]})');
ready
json parse
r = jp('{"name":"George", "age":29, "friends":["John", "Sarah", "Albert"]}');
ready
Function result - as per jQuery
r = (new Function('return {"name":"George", "age":29, "friends":["John", "Sarah", "Albert"]}'))()
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published on
  • Revision 2: published by Ben Combee on
  • Revision 3: published by Richard Green on