4 Replies Latest reply on Aug 25, 2007 11:57 AM by brado77

    XMLListCollection vs. ArrayCollection perofrmance

    brado77
      Hello,

      I was recently speaking with a colleague about the merits of working with native XML across client and server tiers of a Flex app vs. marshaling/unmarshaling XML to/from objects, and he mentioned that in his experience, the performance of working with ArrayCollections was much better than that of XMLListCollections, up to an order of magnitude or better. I wanted to try to verify this, and if true, to inquire as to the reason for this -- is it an initial design issue, and will be fixed, or is this something that is known and expected to be the situation going forward?

      The reason I am asking, of course, is to try to determine if it is wiser to orient client and server code to standard objects, and marshal in and out of xml, or orient the client and server to native xml. Native XML structures and E4X on the client seem attractive, if it eliminates marshaling, but if it comes with a major performance price, then I'm inclined not to go that route.

      Thanks for your help.

      Brad
        • 1. Re: XMLListCollection vs. ArrayCollection perofrmance
          ntsiii Level 3
          In the words of a top-notch flex engineer, Alex Harui, on this topic:

          "I haven't done any formal measurements. E4x seems pretty fast to me.

          XMLListCollection, though, adds overhead for changewatchers and if the data is static that may not be worth the cost. Also, I would expect that E4x queries that drill down levels are going to add up compared to "caching it" in a sealed class instance. And then there might be type conversion if your data contains numbers. The list classes are not careful about how often they query for a property which is a fast prop lookup on a sealed class and some probably-slower thing in XML.

          But you can bet that any time I grab data off a server it'll be in e4x until I see that that is what is killing me."

          Tracy
          • 2. Re: XMLListCollection vs. ArrayCollection perofrmance
            brado77 Level 1
            Tracy, thanks for the response. Here's a blog post I found that comments on this, and actually is related to some apparent comments from someone from Adobe on this very issue, and suggests that E4X may be a liability, at least from a memory standpoint. I'd be interested to get your thoughts on this. Here's the blog post:

            http://blog.fastlanesw.com/?p=14

            Let me know your thoughts -- it would be great to get a reply from someone at Adobe who could give a current "state of the state" regarding this -- it is a pretty significant architectural issue, and I'd love to definitively know the best design approach.

            Brad
            • 3. Re: XMLListCollection vs. ArrayCollection perofrmance
              ntsiii Level 3
              As usual, it will come down to your specific application, what is does, how it will be used, design and implementation cost-benefit analysis, etc.

              The theoretical best-practice can be a poor business choice.

              The e4x memory leak issue will be an interesting thing to watch.

              Tracy

              • 4. Re: XMLListCollection vs. ArrayCollection perofrmance
                brado77 Level 1
                Tracy,

                Thanks for the response. I'm not speaking of anything theoretical here. I'm asking about a fixed performance difference between using XMLListCollections and ArrayCollections. If there is a significant cost to using XMLListCollections vs. using ArrayCollections, then for the purposes of designing a client-server architecture on marshaling in/out of data obects vs. XML, the XML/E4X is ill-advised. I don't know how it could be viewed otherwise. And if there are memory issues whenever E4X is used in data-binding as well, I'm not quite sure what the production purpose of E4X would be. I mean, it might be great for prototyping, but why would you base a system architecture on something that has a potential order of magnitude (referring to my colleague's claim here) performance hit, and a significant memory penalty?

                Hence my desire to confirm this. E4X is dynamite for convenience. But clients don't much care about developer convenience, they want a solid, stable, performant application. And if this is true, it pretty much takes any use of E4X off the table, which would be a shame, because I'd much prefer to use E4X. Is there any way to contact Adobe with questions?

                Thanks,

                Brad