Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the scenario described in the post might be deliberately contrived. JQuery uses window.eval ( http://dev.jquery.com/browser/trunk/jquery/src/ajax.js#L503 ) to parse JSON, not Douglas Crockford's json.js. So, merely swapping XML with JSON shouldn't result in as much of a slow down (if not a speedup) as the graph tends to indicate.


http://www.json.org/json2.js

and here's the appropriate comment:

  // In the third stage we use the eval function to compile the text into a
  // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
  // in JavaScript: it can begin a block or an object literal. We wrap the text
  // in parens to eliminate the ambiguity.
So um, json.js does use eval, same as jQuery.

On http://www.pcapr.net, we use tons of javascript and I've noticed returning "large" JSON arrays makes quite a few different browsers croak.


Also read this about native JSON:

http://blog.mozilla.com/webdev/2009/02/12/native-json-in-fir...

Which could make the speed comparable, but just on FF31




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: