1
0
mirror of https://github.com/msgpack/msgpack-c.git synced 2025-03-20 05:27:56 +01:00

27 lines
636 B
Perl
Raw Normal View History

2009-04-15 12:55:41 +09:00
use strict;
use warnings;
use Data::MessagePack;
use JSON::XS;
2010-09-10 20:27:11 +09:00
use Storable;
2009-04-15 12:55:41 +09:00
use Benchmark ':all';
my $a = {
"method" => "handleMessage",
"params" => [ "user1", "we were just talking" ],
"id" => undef,
"array" => [ 1, 11, 234, -5, 1e5, 1e7, 1, 0 ]
};
2009-04-15 12:55:41 +09:00
print "-- serialize\n";
2009-04-15 23:02:27 +09:00
print "JSON::XS: $JSON::XS::VERSION\n";
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
2010-09-10 20:27:11 +09:00
print "Storable: $Storable::VERSION\n";
timethese(
1000000 => {
json => sub { JSON::XS::encode_json($a) },
storable => sub { Storable::freeze($a) },
mp => sub { Data::MessagePack->pack($a) },
2009-04-15 12:55:41 +09:00
}
);