Kenny wrote:
Thanks Jim, I'll check it out.
I was afraid that parsing the XML in ActionScript would to slow to get
any benefits out of the speed SAX provides. Did you do any speed
comparison between using SAX, and text parsing written in ActionScript
and iterating through the document using the native XML object?

Parsing via my SAX implementation is *much* slower than using the native XML object, at least when I originally implemented and tested it back in the early days of Flash MX 2004.

I had throughputs of about 1KB/sec using my parser on my 1.2GHz Celeron development machine at the time, which was roughly an order of magnitude slower than the native XML object's performance (as assessed by capture of the raw text via XML.onData and than timing the creation of a new XML object given the text). Claus obtained rather similar results with his CSS parser--string handling is definitely not one of Flash's strong points. Your mileage will likely vary with today's faster processors and the new Flash Player, but you will most definitely take a signficant hit in terms of performance relative to the native XML object.

If you're looking for speed, you're probably better off writing a custom iterator to walk through a native XML object (perhaps using XPath) and then dispatch events or execute callback functions off from that rather than using my SAX parser.

At present, the only clear reason I can see for choosing SAX over MM's XML object is for the case when you have no control over the XML content and must handle the full gamut of XML 1.0 nodes, that is, handling the node types that MM's native XML object does not: comments, CDATA and PIs. In my case, the need to handle these node types was the driving reason for porting SAX to Actionscript.

Jim



_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to