Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: XML::Simple Benchmarks with various backends

by leriksen (Curate)
on Nov 23, 2004 at 00:19 UTC ( #409773=note: print w/ replies, xml ) Need Help??


in reply to Re: XML::Simple Benchmarks with various backends
in thread XML::Simple Benchmarks with various backends

OK I added this one

  • XML::SAX::ExpatXS - a SAX event generator wrapped around Expat, quite possibly a closer binding than XML::SAX::Expat - 1.02

Extra code is

$backend = 'XML::SAX::ExpatXS'; my $xml_x_s_exs; { local $ENV{XML_SIMPLE_PREFERRED_PARSER} = $backend; $start = time(); $xml_x_s_exs = $xs->XMLin($XMLFile); $end = time(); } print_result($backend, $end, $start, $size); ... is_deeply($xml_default, $xml_x_s_exs);

New results are

[le6303@itdevtst perl]$ ./xml.pl bigxml.xml File bigxml.xml is 1730463 bytes XML::Simple with default backend took 12.7477 seconds. This equates to + 135747.5992 kilobytes per second (1024 bytes per k) XML::Simple with XML::Parser backend took 3.5870 seconds. This equates + to 482431.8874 kilobytes per second (1024 bytes per k) XML::Simple with XML::SAX::Expat backend took 13.7021 seconds. This eq +uates to 126292.1408 kilobytes per second (1024 bytes per k) XML::Simple with XML::SAX::ExpatXS backend took 5.9447 seconds. This e +quates to 291093.0139 kilobytes per second (1024 bytes per k) XML::Simple with XML::LibXML::SAX backend took 6.5013 seconds. This eq +uates to 266172.9123 kilobytes per second (1024 bytes per k) ok 1 ok 2 ok 3 ok 4 1..4

So a good result, but the ol' original XML::Parser is still faster. ExpatXS may be a faster parser, but it may not be as effective as a SAX generator. More research is required - anyone, anyone...

I may get time on the weekend to try these with some more types of XML document e.g. one that references external entities (standalone="false"), large UUencoded binary blobs in CDATA sections, very small files etc

use brain;


Comment on Re^2: XML::Simple Benchmarks with various backends
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://409773]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2014-09-23 08:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (212 votes), past polls