mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-22 16:33:49 +01:00
perl: make pp benchmarks available
This commit is contained in:
parent
b402849557
commit
c2bf2a8174
perl/benchmark
@ -1,25 +1,25 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::MessagePack;
|
||||
use JSON::XS;
|
||||
use Benchmark ':all';
|
||||
use JSON;
|
||||
use Storable;
|
||||
use Benchmark ':all';
|
||||
|
||||
#$Data::MessagePack::PreferInteger = 1;
|
||||
|
||||
my $a = do 'benchmark/data.pl';
|
||||
|
||||
my $j = JSON::XS::encode_json($a);
|
||||
my $j = JSON::encode_json($a);
|
||||
my $m = Data::MessagePack->pack($a);
|
||||
my $s = Storable::freeze($a);
|
||||
|
||||
print "-- deserialize\n";
|
||||
print "JSON::XS: $JSON::XS::VERSION\n";
|
||||
print "$JSON::Backend: ", $JSON::Backend->VERSION, "\n";
|
||||
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
|
||||
print "Storable: $Storable::VERSION\n";
|
||||
cmpthese timethese(
|
||||
-1 => {
|
||||
json => sub { JSON::XS::decode_json($j) },
|
||||
json => sub { JSON::decode_json($j) },
|
||||
mp => sub { Data::MessagePack->unpack($m) },
|
||||
storable => sub { Storable::thaw($s) },
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::MessagePack;
|
||||
use JSON::XS;
|
||||
use JSON;
|
||||
use Storable;
|
||||
use Benchmark ':all';
|
||||
|
||||
my $a = do 'benchmark/data.pl';
|
||||
|
||||
print "-- serialize\n";
|
||||
print "JSON::XS: $JSON::XS::VERSION\n";
|
||||
print "$JSON::Backend: ", $JSON::Backend->VERSION, "\n";
|
||||
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
|
||||
print "Storable: $Storable::VERSION\n";
|
||||
cmpthese timethese(
|
||||
-1 => {
|
||||
json => sub { JSON::XS::encode_json($a) },
|
||||
json => sub { JSON::encode_json($a) },
|
||||
storable => sub { Storable::freeze($a) },
|
||||
mp => sub { Data::MessagePack->pack($a) },
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user