Skip to content

Instantly share code, notes, and snippets.

@nrh
Created November 8, 2010 00:40
Show Gist options
  • Save nrh/667234 to your computer and use it in GitHub Desktop.
Save nrh/667234 to your computer and use it in GitHub Desktop.
#!/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`;
cmpthese(1000,
{
'syck' => sub { my $obj = YAML::Syck::Load($yaml); my $string = YAML::Syck::Dump($obj); },
'xs' => sub { my $obj = YAML::XS::Load($yaml); my $string = YAML::XS::Dump($obj); },
});
[nrh@toki ~/projects/pogo] perl comp.pl
(warning: too few iterations for a reliable count)
Rate xs syck
xs 34.9/s -- -99%
syck 6250/s 17806% --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment