JSON/XML? Ideal data source format for Grid
January 7th, 2009Since the grid took the most time to load among all the Ext widgets, I wanted to cut down the loading time as much as possible.
My question is, given the target browsers of ie6 and ff, what would be the ideal data source for the grid?
Assuming that the server side is flexible enough to output either format efficiently:
- xml require more bandwidth because of the verbose tags
- both browsers has built-in support for parsing the xml file natively given that the mime-type is set properly. (responseXML)
- json needs to be eval(). I'm not sure if the security check during eval will be a problem for large set of data (200-500 rows?).
I noticed that json is a bit faster than xml when used as a data source for grid in some of my informal testing. (In the paging grid example Jack used json).
Also, if you want to manipulate the data in javascript, JSON is much nicer to work with than the XML dom.
Do you guys have any war stories to share?
Thanks.
I believe it depends on how the data is intended to be used. If it is intended to be used as js object/array, JSON is much faster. However, if it is intended to be used as DOM element, I have read some articles which show a significant rendering speed advantage as XSLT processor is much faster than javascript.
The on the wire load is another issue though with gzip, the difference is not that huge.
huge.
In this case, the data is not processed with XSLT, but is extracted from the XML document and used as javascript data, so there's really nothing to recommend XML for new developments.
If you are stuck with existing XML sources, then use an XmlReader for your grid, but if it's new development, I'd go with Json.
#If you have any other info about this subject , Please add it free.# |
