2 Replies Latest reply on Jun 6, 2006 1:22 PM by blemmo

    LoadVars or Xml ??

    Mad_Rhino
      Hi there i have a flash application which retreives data from a MYSQL database. That data is loaded by LoadVars, but i have recently been reading up upon the flash8 xml parser and would like to know which method is faster and more efficient in retreiveing and parsing large amounts of data from a database?

      Any advise is much appreciated.
        • 1. Re: LoadVars or Xml ??
          Level 7
          LoadVars follows a traditional internet standard of URL vars. It represents
          data in a less structured and more linear, however with clever packaging of
          the variable data you can achieve data structure hierachial depths.

          XML is more structured, allows for hierachial data structures and follows a
          newer industry standard. However depending on the depth of you XML
          structure and the efficiency of the parsing code, it can be slower than
          using URL vars. You will likely need parsing on both the client and server.

          Bottom line is if the data structure is simple, LoadVars is quicker to build
          and to run.

          As the data structures become more complex, LoadVars puts more burden on the
          programming code to determine structure.

          --
          Lon Hosford
          www.lonhosford.com
          Flash, Actionscript and Flash Media Server examples:
          http://flashexamples.hosfordusa.com
          May many happy bits flow your way!
          "Mad Rhino" <webforumsuser@macromedia.com> wrote in message
          news:e647lp$86d$1@forums.macromedia.com...
          Hi there i have a flash application which retreives data from a MYSQL
          database.
          That data is loaded by LoadVars, but i have recently been reading up upon
          the
          flash8 xml parser and would like to know which method is <b>faster</b> and
          <b>more efficient</b> in retreiveing and parsing large amounts of data from
          a
          database?

          Any advise is much appreciated.


          • 2. Re: LoadVars or Xml ??
            blemmo Level 1
            As Lon already stated, XML can produce some overhead. Imagine a boolean value returned by the server: with loadVars, it might look like this:
            bool=1
            whereas in XML, it adds a lot of data:
            <?xml version="1.0" encoding="UTF-8" ?>
            <result><bool value="1" /></result>
            (of course, you don't always have to use complete xml documents, Flash can also handle single xml nodes).
            XML also needs de-/serialization on server and client side, so I'd say that LoadVars should be faster.

            But, on the other hand, xml is a lot easier to use when the data gets complex, which can make it more efficient than LoadVars.

            If you have to transfer large amounts of complex data, e.g. complete record sets from a database, then Flash Remoting should be interesting for you. It lets you pass complex objects, like arrays, directly from Flash to the server and vice versa, without any de-/serialization. There's a nice benchmark test between SOAP and Remoting here: http://www.flashorb.com/articles/soap_vs_flash_remoting_benchmark.htm.
            XML transfer is not SOAP, but there's not such a big difference (SOAP also uses xml for data transfer), so it should be quite similar to the SOAP results.

            More info on Remoting and a good tutorial can be found here: http://www.actionscript.org/tutorials/intermediate/PHP_Remoting/index.shtml

            greets,
            blemmo