Guest User

Untitled

a guest
Jun 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!/usr/local/bin/perl -w
  2.  
  3. use common::sense;
  4. use Benchmark qw(:all);
  5.  
  6. use YAML::Syck qw();
  7. use YAML::XS qw();
  8.  
  9. my $yaml = `cat foo.yaml`;
  10.  
  11. cmpthese(1000,
  12. {
  13. 'syck' => sub { my $obj = YAML::Syck::Load($yaml); my $string = YAML::Syck::Dump($obj); },
  14. 'xs' => sub { my $obj = YAML::XS::Load($yaml); my $string = YAML::XS::Dump($obj); },
  15. });
  16.  
  17. [nrh@toki ~/projects/pogo] perl comp.pl
  18. (warning: too few iterations for a reliable count)
  19. Rate xs syck
  20. xs 34.9/s -- -99%
  21. syck 6250/s 17806% --
Add Comment
Please, Sign In to add comment