Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New add_crc pack function #7

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ if ( $] >= 5.008005 and want_xs() ) {
cc_warnings;
cc_include_paths('include');
cc_src_paths('xs-src');
cc_libs '-lz';
postamble (qq{
xs-src/pack.o : xshelper.h include/msgpack/pack_define.h include/msgpack/pack_template.h include/msgpack/sysdep.h
xs-src/unpack.o : xshelper.h include/msgpack/unpack_define.h include/msgpack/unpack_template.h include/msgpack/sysdep.h
xs-src/crc32.o : xshelper.h include/msgpack/sysdep.h
});

if($Module::Install::AUTHOR) {
Expand Down
2 changes: 2 additions & 0 deletions benchmark/deserialize.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

my $j = JSON::encode_json($a);
my $m = Data::MessagePack->pack($a);
my $m_crc = Data::MessagePack->pack($a); Data::MessagePack->add_crc($m_crc);
my $s = Storable::freeze($a);

print "-- deserialize\n";
Expand All @@ -21,6 +22,7 @@
-1 => {
json => sub { JSON::decode_json($j) },
mp => sub { Data::MessagePack->unpack($m) },
mp_crc => sub { Data::MessagePack->unpack($m_crc) },
storable => sub { Storable::thaw($s) },
}
);
Expand Down
6 changes: 6 additions & 0 deletions benchmark/pack_dl.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use Data::MessagePack;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $p3 = Data::MessagePack->pack( \%h3 ) for (1 .. 10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_dm.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use Data::MessagePack;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $p2 = Data::MessagePack->pack( \%h2 ) for (1 .. 10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_ds.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use Data::MessagePack;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $p1 = Data::MessagePack->pack( \%h1 ) for (1...10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_jl.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use JSON;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $j3 = JSON::encode_json( \%h3 ) for (1 .. 10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_jm.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use JSON;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $j2 = JSON::encode_json( \%h2 ) for (1 .. 10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_js.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use JSON;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $j1 = JSON::encode_json( \%h1 ) for (1 .. 10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_sl.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use Storable;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $s3 = Storable::freeze( \%h3 ) for (1 .. 10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_sm.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use Storable;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $s2 = Storable::freeze( \%h2 ) for (1 .. 10_000);
6 changes: 6 additions & 0 deletions benchmark/pack_ss.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- perl -*-
use Storable;
# benchmark small (50b), middle (2-3k) and large hashes (~100k)
do 'benchmark/wordlist.pl';

my $s1 = Storable::freeze( \%h1 ) for (1 .. 10_000);
1 change: 1 addition & 0 deletions benchmark/serialize.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
json => sub { JSON::encode_json($a) },
storable => sub { Storable::freeze($a) },
mp => sub { Data::MessagePack->pack($a) },
mp_crc => sub { my $p = Data::MessagePack->pack($a); Data::MessagePack->add_crc($p); },
}
);

Loading