mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-19 04:52:59 +01:00
Improve benchmarks
This commit is contained in:
parent
0768cf17b6
commit
0f02ef20a9
@ -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) },
|
||||
|
@ -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) },
|
||||
|
Loading…
x
Reference in New Issue
Block a user