Subject: | poor performance with large(r) files |
YAML::LibYAML's performance seems to degrade *significantly* with file size. see the benchmarking below.
[nrh@toki ~] cat comp.pl
#!/usr/local/bin/perl -w
use common::sense;
use Benchmark qw(:all);
use YAML::Syck qw();
use YAML::XS qw();
my $yaml = `cat foo.yaml`;
my $size = -s "foo.yaml";
print "file size: " . $size . "b\n";
cmpthese( 10000, {
'YAML::Syck-' . $YAML::Syck::VERSION => sub { my $obj = YAML::Syck::Load($yaml); my $string = YAML::Syck::Dump($obj); },
'YAML::XS-' . $YAML::XS::VERSION => sub { my $obj = YAML::XS::Load($yaml); my $string = YAML::XS::Dump($obj); },
}
);
[nrh@toki ~/projects/pogo] perl ./comp.pl
file size: 650b
Rate YAML::XS-0.34 YAML::Syck-1.15
YAML::XS-0.34 1927/s -- -2%
YAML::Syck-1.15 1969/s 2% --
(cp large.yaml foo.yaml)
[nrh@toki ~] perl ./comp.pl
file size: 32455b
Rate YAML::XS-0.34 YAML::Syck-1.15
YAML::XS-0.34 44.3/s -- -99%
YAML::Syck-1.15 6098/s 13666% --