Elliott
07-16-2009, 03:56 PM
Hi,
I have been tasked with creating a JavaScript display engine for content located within a rather large XML file (22924 lines, 1.52 MB). Unfortunately I do not have control over the layout of this file.
Currently I have written a custom object that is extended using prototype which converts the XML and allows for quick adding, filtering and sorting of the content based on various parameters; however the only thing currently slowing it down is the initial load of the XML data.
To load the data, I am using jQuery to make it easy to traverse the XML data flow and then for each match it calls my custom object. This process takes 4 seconds on my machine and due to the way JavaScript works does full blocking - on a slower machine it has taken 10 seconds. Does anyone have any recommendations on how to possibly speed up this process or eliminate the blocking of the browser?
Here is a quick example of the XML format:
<xml>
<product name="XXXX1">
<segment name="XXXX1_YYYY1">
<plan name="XXXX1_YYYY1_ZZZZ1">
<data name="content" />
<data name="content" />
<data name="content" />
</plan>
<plan name="XXXX1_YYYY1_ZZZZ2">
<data name="content" />
<data name="content" />
<data name="content" />
</plan>
</segment>
<segment name="XXXX1_YYYY2">
<plan name="XXXX1_YYYY2_ZZZZ1">
<data name="content" />
<data name="content" />
</plan>
</segment>
</product>
<product name="XXXX2">
<segment name="XXXX2_YYYY1">
<plan name="XXXX2_YYYY1_ZZZZ1">
<data name="content" />
</plan>
</segment>
</product>
</xml>
Also as side-note - currently I only load a single product in at a time, to help speed things up - my next step may be to load in each segment at a time but this is a little more cumbersome as we need a single product loaded to be able to start.
Any ideas or suggestions are appreciated!
I have been tasked with creating a JavaScript display engine for content located within a rather large XML file (22924 lines, 1.52 MB). Unfortunately I do not have control over the layout of this file.
Currently I have written a custom object that is extended using prototype which converts the XML and allows for quick adding, filtering and sorting of the content based on various parameters; however the only thing currently slowing it down is the initial load of the XML data.
To load the data, I am using jQuery to make it easy to traverse the XML data flow and then for each match it calls my custom object. This process takes 4 seconds on my machine and due to the way JavaScript works does full blocking - on a slower machine it has taken 10 seconds. Does anyone have any recommendations on how to possibly speed up this process or eliminate the blocking of the browser?
Here is a quick example of the XML format:
<xml>
<product name="XXXX1">
<segment name="XXXX1_YYYY1">
<plan name="XXXX1_YYYY1_ZZZZ1">
<data name="content" />
<data name="content" />
<data name="content" />
</plan>
<plan name="XXXX1_YYYY1_ZZZZ2">
<data name="content" />
<data name="content" />
<data name="content" />
</plan>
</segment>
<segment name="XXXX1_YYYY2">
<plan name="XXXX1_YYYY2_ZZZZ1">
<data name="content" />
<data name="content" />
</plan>
</segment>
</product>
<product name="XXXX2">
<segment name="XXXX2_YYYY1">
<plan name="XXXX2_YYYY1_ZZZZ1">
<data name="content" />
</plan>
</segment>
</product>
</xml>
Also as side-note - currently I only load a single product in at a time, to help speed things up - my next step may be to load in each segment at a time but this is a little more cumbersome as we need a single product loaded to be able to start.
Any ideas or suggestions are appreciated!