On Sat, 2008-04-05 at 13:41 +0200, Duncan Webb wrote:
> So the remaining question is, are SAX parsers much faster than DOM, if 
> not then I propose that we replace all the xml parsers with ElementTree, 
> then we could use code like:

The bundled sax parser is not only vastly faster than the dom parser,
but uses significantly less memory.  Here is a paste from some analysis
I did last year, where I ran the parser through my TV.xml.

        Parser          Time [1]  Peak Memory [2]
        --------------- --------- -----------------
        expat           4.4s      855 KB
        sax             7.8s      2650 KB
        minidom         1m42s [3] 590000 KB [3]
        cElementTree    3.3s      119000 KB
        libxml2 (SAX)   4.2s      24700 KB
        libxml2 (DOM)   3.7s      123000 KB
        
        [1] Average of 3 runs
        [2] As reported by memprof
        [3] Killed it before completion after it caused significant
            thrashing

Based on this analysis, we're using xml.sax in kaa (especially epg), as
dischi said.  minidom should absolutely be avoided, unless it's a
certainty that the XML is small, such as (as you pointed out) fxd files.

Based on the numbers I'm not sure there is a substantial benefit to
cElementTree over sax.  The API is perhaps simpler.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to