Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML::Syck still outperforms YAML::XS #62

Open
toddr opened this issue Aug 11, 2017 · 2 comments
Open

YAML::Syck still outperforms YAML::XS #62

toddr opened this issue Aug 11, 2017 · 2 comments

Comments

@toddr
Copy link

toddr commented Aug 11, 2017

Results first:

$>perl bench.pl 
YAML::Syck 1.29: Ran 21 iterations (0 outliers).
YAML::Syck 1.29: Rounded run time per iteration: 1.3650e-01 +/- 2.9e-04 (0.2%)
YAML::XS 0.63: Ran 21 iterations (1 outliers).
YAML::XS 0.63: Rounded run time per iteration: 2.4036e-01 +/- 1.8e-04 (0.1%)

The code:

$>cat bench.pl 
use strict;
use warnings;
use Dumbbench;
use YAML::XS ();
use YAML::Syck ();
my $bench = Dumbbench->new(
    target_rel_precision => 0.005, # seek ~0.5%
    initial_runs         => 20,    # the higher the more reliable
);
my $obj = YAML::Syck::LoadFile("ssl.yaml");
$bench->add_instances(
    Dumbbench::Instance::PerlSub->new(name => 'YAML::Syck ' . $YAML::Syck::VERSION, code => sub { my $string = YAML::Syck::Dump($obj); }),
    Dumbbench::Instance::PerlSub->new(name => 'YAML::XS ' . $YAML::XS::VERSION, code => sub { my $string = YAML::XS::Dump($obj); }),
);
$bench->run;
$bench->report;
@toddr
Copy link
Author

toddr commented Aug 11, 2017

Data file attached:

ssl.yaml.txt

@perlpunk
Copy link
Collaborator

Ah, I see, thanks. I thought you were talking about Load. I haven't benchmarked Dump myself yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants