A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: loadXML vs loadVariables - performance

  1. #1
    Senior Member
    Join Date
    Oct 2000
    Posts
    519
    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?

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    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...

  3. #3
    Senior Member
    Join Date
    Oct 2000
    Posts
    519
    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.

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Posts
    296
    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?

  5. #5
    Junior Member
    Join Date
    Apr 2001
    Posts
    23
    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.

  6. #6
    Senior Member
    Join Date
    Oct 2000
    Posts
    519
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center