29 ms·
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#L50
by woadwarrior01 18y ago
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 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.
- kowsik 18y agohttp://www.json.org/json2.js 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 http://www.pcapr.net, we use tons of javascript and I've noticed returning "large" JSON arrays makes quite a few different browsers croak.
- kowsik 18y agoAlso read this about native JSON: http://blog.mozilla.com/webdev/2009/02/12/native-json-in-firefox-31/ http://blog.mozilla.com/webdev/2009/02/12/native-json-in-fir... Which could make the speed comparable, but just on FF31