Changes for version 1.15

  • 28% Performance improvements. Benchmark was the following program:
    • use XML::DOM; $dom = XML::DOM::Parser->new; my $doc = $dom->parsefile ("samples/REC-xml-19980210.xml");
    • Running it 20 times on a Sun Ultra-1, using the ksh function 'time', the average time was 9.02s (real time.) XML::Parser 2.19, Perl 5.005_02. As a comparison, XML-Grove-0.05 takes 2.17s running:
      • use XML::Parser; use XML::Parser::Grove; use XML::Grove;
      • $parser = XML::Parser->new(Style => 'Grove'); $grove = $parser->parsefile ("samples/REC-xml-19980210.xml");
    • And XML::Parser 2.19 takes 0.71s running (i.e. building nothing):
      • use XML::Parser; $parser = XML::Parser->new; $parser->parsefile ("samples/REC-xml-19980210.xml");
    • XML-Grove-0.40alpha takes 4.62s running the following script:
      • use XML::Grove::Builder; use XML::Parser::SAXPerl; $grove_builder = XML::Grove::Builder->new; $parser = XML::Parser::SAXPerl->new ( Handler => $grove_builder ); $document = $parser->parse ( Source => { SystemId => "samples/REC-xml-19980210.xml" } );
    • Each following improvement knocked a few tenths of a second off:
    • Reimplemented the ReadOnly mechanism, because it was spending a lot of time in setReadOnly when parsing large documents (new time: 8.00s)
    • Hacked appendChild to squeeze out a little speed (new time: 7.70s)
    • Eliminated calls to addText in the Start handler which had to figure out every time wether it should add a piece of text to a previous text node. Now I keep track of whether the previous node was a text node in the XML::DOM::Parser code and take care of adding the text and creating a new Text node right there, without the overhead of several function calls (new time: 6.45s)

Modules

A perl module for building DOM Level 1 compliant document structures