Subject: | findvalue from XML::LibXML 1.74 is very slow (regression) |
With XML::LibXML 1.74, findvalue is very slow, at least on large files.
See the attached testcase. Here are the timings on my Mac OS X 10.4.11
PowerPC machine, with XML::LibXML from MacPorts:
* 0.51s user time with XML::LibXML 1.70
* 6.04s user time with XML::LibXML 1.74
Perl version:
This is perl 5, version 12, subversion 3 (v5.12.3) built for
darwin-multi-2level
Subject: | libxml-findvalue.pl |
#!/usr/bin/env perl
use strict;
use XML::LibXML;
my $file = 'test-huge.xml';
-e $file and die;
open FILE, '>', $file or die;
print FILE "<?xml version=\"1.0\"?>\n<root>\n" or die;
foreach (1..6000)
{ print FILE "<a attr=\"test\"/>\n" or die; }
print FILE "</root>\n" or die;
close FILE or die;
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($file);
my $n = 0;
foreach my $node ($doc->findnodes('//a'))
{
my $v = $node->findvalue('@attr');
$v eq 'test' or die;
$n++;
}
print "$n\n";
unlink $file;