in reply to Replacing XML::Simple XMLout with Lib::XML
Have we made a fundamental error somewhere...
I think yes. Your libxml_output() re-structures the passed $xml, then stringifies, the xmlsimple_output() just stringifies the passed $xml, generated by XMLin() beforehand. The subroutines are not comparable.
Just measuring the performance of stringification ...
#!/usr/bin/perl -w use strict; use XML::Simple; use XML::LibXML; use Benchmark qw(cmpthese); my $file = shift or die "usage: $0 xmlfile\n"; my $xml = XMLin( $file); my $dom = XML::LibXML->load_xml(location => $file); cmpthese ( -1, { simple => sub { XMLout($xml) }, libxml => sub { $dom->toString() }, } ); __END__ Rate simple libxml simple 29.4/s -- -96% libxml 658/s 2141% --
... gives a different picture. Are you working internally with $xml or $dom ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replacing XML::Simple XMLout with Lib::XML
by amasidlover (Sexton) on Feb 15, 2018 at 14:56 UTC |