msgpack/perl/benchmark/serialize.pl

22 lines
508 B
Perl
Raw Normal View History

2009-04-15 12:55:41 +09:00
use strict;
use warnings;
use Data::MessagePack;
2010-09-18 16:16:51 +09:00
use JSON;
2010-09-10 20:27:11 +09:00
use Storable;
2009-04-15 12:55:41 +09:00
use Benchmark ':all';
2010-09-18 15:49:25 +09:00
my $a = do 'benchmark/data.pl';
2009-04-15 12:55:41 +09:00
print "-- serialize\n";
2010-09-18 16:16:51 +09:00
print "$JSON::Backend: ", $JSON::Backend->VERSION, "\n";
2009-04-15 23:02:27 +09:00
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
2010-09-10 20:27:11 +09:00
print "Storable: $Storable::VERSION\n";
2010-09-15 12:46:11 +09:00
cmpthese timethese(
-1 => {
2010-09-18 16:16:51 +09:00
json => sub { JSON::encode_json($a) },
storable => sub { Storable::freeze($a) },
mp => sub { Data::MessagePack->pack($a) },
2009-04-15 12:55:41 +09:00
}
);