Subject: | measuring performance |
I was looking into how to determine the performance of the module. I had
posted finding your module also on Perl XML List <perl-
xml@listserv.activestate.com>.
I have no good idea how to determine performance. I thought of comparing
saxon via command line with saxon thru your module.
Maybe it would help to include a script in the module to do so. I am
uncertain of the details, but my current attempt looks like this
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark;
my $start = new Benchmark; #start timer
#had to change cygwin memory according to
#http://www.cygwin.com/cygwin-ug-net/setup-maxmem.html
#to 2048 something in order to make my script run
#use Inline::Java( EXTRA_JAVA_ARGS => '-Xmx256m' );
use XML::Saxon::XSLT2;
#ARGV[0]
if ( !-e $ARGV[0] ) {
die "$ARGV[0] does not exist";
}
#my $source;
open( my $source, '<:encoding(UTF-8)', $ARGV[0] ) or die $!;
#ARGV[1]
if ( !-e $ARGV[0] ) {
die "$ARGV[0] does not exist";
}
my $xslt;
open( $xslt, '<:encoding(UTF-8)', $ARGV[1] ) or die $!;
my $transformer = XML::Saxon::XSLT2->new($xslt);
my $result = $transformer->transform($source);
#write result to file
open( my $fh, '>:encoding(UTF-8)', 'o.xml' ) or die $!;
print $fh $result;
close($fh);
# end timer
my $end = new Benchmark;
# calculate difference
my $diff = timediff( $end, $start );
# report
print "Time taken was ", timestr( $diff, 'all' ), " seconds";