Click to See Complete Forum and Search --> : loadXML vs loadVariables - performance

07-12-2001, 10:55 AM
A general question. Is it faster to load information as XML as opposed to using loadVariables?

I'm currently using an asp script to serve up a comma delimited string of numbers and using load variables to get the string and then splitting it into an array. This seems pretty slow when the string gets quite long. I could alternatively have the asp script format it into an XML string and load it into an XML object and then parse it that way. I don't want to bother unless it is definitively a better, more performant approach.

Any ideas?

07-12-2001, 01:22 PM
So XML should be thought of as a better way to 'format' the data - not necessarily a better way to 'transmit' the data... It might end up being better, but, I haven't done any testing along those lines.

The main thing you have to keep in mind, is that it's more important how you structure your data in XML, than anything else.

P.s. - when you say that your 'string' is getting long... what are you talking about... 'cause personally - I don't think Flash's string parser is that hot either...

07-13-2001, 04:18 AM
Thanks for the reply. Actually I have narrowed down what exactly is causing the problem. It is the following statement that is taking ages:

bookingArray = bookingData.split(",");

So in fact the data loads quite quickly, it's just splitting it into the array that's taking the time. The structure is obviously very simple so I may try using XML to parse it instead.

So watch out for this everyone.

07-13-2001, 08:59 AM
XML comes into its own when you need whole data STRUCTURES rather than just a load of variables. It's not going to load any faster than a string of variables. My machine loads, cleans and parses over 1000 nodes of XML in about 3 seconds. That's not bad huh?

07-16-2001, 05:43 PM
bookingArray = bookingData.split(",");

Yup that's the killer, split is surprisingly slow.
When I need to parse in even a moderate array I run into this problem. What I have generally done is to make a movie clip which uses sub string and index of to strip off each value one or 2 per frame instead so that animation continues during the parsing.

07-17-2001, 06:50 AM
Now that I've converted it to XML and avoided the split function I'm not having any problems at all. I thought I must be doing something wrong if 4k of data was jamming my machine.