Improve benchmarks

This commit is contained in:
gfx 2010-09-15 12:46:11 +09:00
parent 0768cf17b6
commit 0f02ef20a9
2 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ my $a = {
"method" => "handleMessage",
"params" => [ "user1", "we were just talking" ],
"id" => undef,
"array" => [ 1, 11, 234, -5, 1e5, 1e7, 1, 0 ]
"array" => [ 1, 11, 234, -5, 1e5, 1e7, 1, 0, 3.14, sqrt(2) ]
};
my $j = JSON::XS::encode_json($a);
my $m = Data::MessagePack->pack($a);
@ -19,8 +19,8 @@ print "-- deserialize\n";
print "JSON::XS: $JSON::XS::VERSION\n";
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
print "Storable: $Storable::VERSION\n";
timethese(
1000000 => {
cmpthese timethese(
-1 => {
json => sub { JSON::XS::decode_json($j) },
mp => sub { Data::MessagePack->unpack($m) },
storable => sub { Storable::thaw($s) },

View File

@ -9,15 +9,15 @@ my $a = {
"method" => "handleMessage",
"params" => [ "user1", "we were just talking" ],
"id" => undef,
"array" => [ 1, 11, 234, -5, 1e5, 1e7, 1, 0 ]
"array" => [ 1, 11, 234, -5, 1e5, 1e7, 1, 0, 3.14, sqrt(2) ]
};
print "-- serialize\n";
print "JSON::XS: $JSON::XS::VERSION\n";
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
print "Storable: $Storable::VERSION\n";
timethese(
1000000 => {
cmpthese timethese(
-1 => {
json => sub { JSON::XS::encode_json($a) },
storable => sub { Storable::freeze($a) },
mp => sub { Data::MessagePack->pack($a) },