Skip Menu |

This queue is for tickets about the XML-Bare CPAN distribution.

Report information
The Basics
Id: 30915
Status: resolved
Priority: 0/
Queue: XML-Bare

People
Owner: Nobody in particular
Requestors: cpan [...] pjedwards.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.27
Fixed in: 0.30



Subject: A pointer mismatch and some suggestions for more perf tests.
Thanks for XML::Bare 0.27 My compiler is suggesting that: struct attc *self = (struct nodec *) malloc( size ); ......................^ %CC-W-PTRMISMATCH, In the initializer for self, the referenced type of the pointer value "(struct nodec ...)malloc(...)" is "struct nodec", which is not compatible with "struct attc". at line number 52 in file PARSER.C I think this should be: struct attc *self = (struct attc *) malloc( size ); I also added this to the start of test.pl because I thought it might ensure that the first test was not taking a hit reading the file. open(DISKCACHE,'<', $file) or die "Couldn't open $!"; while(<DISKCACHE>){ my $line=$_; } close(DISKCACHE); and I added these to the end, just because I was wanted to compare them: if( $ARGV[0] eq '14' ) { ($s, $usec) = gettimeofday(); if( eval( "require XML::Parser;" ) ) { ($s2, $usec2) = gettimeofday(); my $parser = new XML::Parser(); my $doc = $parser->parsefile( $file ); ($s3, $usec3) = gettimeofday(); $sa = $s2-$s + (($usec2-$usec)/1000000); $sb = $s3-$s2 + (($usec3-$usec2)/1000000); $sc = $s3-$s + (($usec3-$usec)/1000000); $sa /= $base1; $sb /= $base2; $sc /= $base3; $sa = fixed( $sa ); $sb = fixed( $sb ); $sc = fixed( $sc ); print 'XML::Parser '.$sa." ".$sb." ".$sc."\n"; } } if( $ARGV[0] eq '15' ) { ($s, $usec) = gettimeofday(); if( eval( "require XML::Parser::Expat;" ) ) { ($s2, $usec2) = gettimeofday(); my $parser = new XML::Parser::Expat(); sub noop{} $parser->setHandlers('Start' => \&noop, 'End' => \&noop, 'Char' => \&noop); open(FOO, $file) or die "Couldn't open $!"; $parser->parse(*FOO); close(FOO); ($s3, $usec3) = gettimeofday(); $sa = $s2-$s + (($usec2-$usec)/1000000); $sb = $s3-$s2 + (($usec3-$usec2)/1000000); $sc = $s3-$s + (($usec3-$usec)/1000000); $sa /= $base1; $sb /= $base2; $sc /= $base3; $sa = fixed( $sa ); $sb = fixed( $sb ); $sc = fixed( $sc ); print 'XML::Parser::Expat '.$sa." ".$sb." ".$sc."\n"; } } Cheers, Peter (Stig) Edwards
I also added a perf test for XML::Descent: Show quoted text
> if( $ARGV[0] eq '16' ) { > ($s, $usec) = gettimeofday(); > if( eval( "require XML::Descent;" ) ) { > ($s2, $usec2) = gettimeofday(); > > my $p = XML::Descent->new({ > Input => $file > }); > $p->on(item => sub { > my ($elem, $attr) = @_; > #print "Found link\n"; > $p->walk; # recurse > }); > $p->walk; > > ($s3, $usec3) = gettimeofday(); > $sa = $s2-$s + (($usec2-$usec)/1000000); > $sb = $s3-$s2 + (($usec3-$usec2)/1000000); > $sc = $s3-$s + (($usec3-$usec)/1000000); > $sa /= $base1; $sb /= $base2; $sc /= $base3; > > $sa = fixed( $sa ); $sb = fixed( $sb ); $sc = fixed( $sc ); > print 'XML::Descent '.$sa." ".$sb." ".$sc."\n"; > } > }
Cheers, Peter (Stig) Edwards
The pointer cast has been fixed in the source for upcoming 0.28. Weird that everything compiled even when it was wrong... As for the reading the entire file into a variable; thanks for pointing that out. It does make a small fraction of a difference and is a sensible thing to do. A similar thing has now been done in 0.28. Thanks also for a couple additional comparisons. At this point I would be happy to add in comparisons to whatever people would like to compare against, because the module seems to win against all competitors as far as speed goes, regardless of what sort of xml parsing is done. I have added those three into 0.28. Please take a look at the new test.pl ( now benchtest.pl ) when 0.28 is released, since it has been cleaned up so that each test is a little less confusing as far as copying funny looking code.
Version 0.30 has now been released to CPAN and included the mentioned changes. On Thu Dec 06 16:43:52 2007, CODECHILD wrote: Show quoted text
> The pointer cast has been fixed in the source for upcoming 0.28. Weird > that everything compiled even when it was wrong... > > As for the reading the entire file into a variable; thanks for pointing > that out. It does make a small fraction of a difference and is a > sensible thing to do. A similar thing has now been done in 0.28. > > Thanks also for a couple additional comparisons. At this point I would > be happy to add in comparisons to whatever people would like to compare > against, because the module seems to win against all competitors as far > as speed goes, regardless of what sort of xml parsing is done. I have > added those three into 0.28. > > Please take a look at the new test.pl ( now benchtest.pl ) when 0.28 is > released, since it has been cleaned up so that each test is a little > less confusing as far as copying funny looking code.