A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: XML Child Node Access Optimization?

  1. #1
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676

    XML Child Node Access Optimization?

    Is there any difference between * and children() when accessing the children of an XML object? Any speed gains by using one versus the other?
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Why do you ask and how do you use * ?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    I have built a custom comboBox component that takes an XML object as the dataprovider (see attached). When it is in enhanced mode, the auto complete and auto filter methods are available to sort the contents of the comboBox. It does this by way of a RegExp created by the value of the user input that tests against attributes in the child nodes of the dataprovider through a loop operation.

    I want to optimize this searching method to improve speeds for very large lists. Right now I have 2 options for accessing the child nodes of an XML object.
    Code:
    var xml : XML =<list>
    <row value="AL" label="Alabama" />
              <row value="AK" label="Alaska"/>
              <row value="AZ" label="Arizona" />
              <row value="AR" label="Arkansas"/>
              <row value="CA" label="California"/>
              <row value="CO" label="Colorado"/>
    </list>
    // Shortened for brevity
    trace(xml.*, xml.children());
    They both return an XMLList with all of the child nodes but by reading the documentation, * seems to be the preferred method for accessing nodes and attributes. I am just wondering what the difference is and whether I might see a performance gain by using one over the other.
    Attached Files Attached Files
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    It is always better to have a concrete path to something so that the player does not need to search or needs to memorize large chunks of whatever. To my experience it is not the parsing of the XML, which is important in the end for speed but the variables and display options. Adding the datatype for every variable, reducing the number of displayobjects to a minimum, choosing Sprites over Movieclips, creating static variables for certain objects all increases performance quite a lot.
    - The right of the People to create Flash movies shall not be infringed. -

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