summaryrefslogtreecommitdiff
path: root/perl/benchmark
diff options
context:
space:
mode:
authorgfx <gfuji@cpan.org>2010-09-18 15:49:25 +0900
committergfx <gfuji@cpan.org>2010-09-18 15:49:25 +0900
commitcb85dcfcb8bdaf706ab515bce4bc1991c990716c (patch)
treeaee531aee80b954f960a8d8fcfa932277fe56e73 /perl/benchmark
parent49379140c7c431c3a27f11dc7565da118dd38f16 (diff)
downloadmsgpack-python-cb85dcfcb8bdaf706ab515bce4bc1991c990716c.tar.gz
perl: tweaks for benchmarks
Diffstat (limited to 'perl/benchmark')
-rwxr-xr-xperl/benchmark/data.pl6
-rw-r--r--perl/benchmark/deserialize.pl8
-rw-r--r--perl/benchmark/serialize.pl7
3 files changed, 9 insertions, 12 deletions
diff --git a/perl/benchmark/data.pl b/perl/benchmark/data.pl
new file mode 100755
index 0000000..6908d1c
--- /dev/null
+++ b/perl/benchmark/data.pl
@@ -0,0 +1,6 @@
++{
+ "method" => "handleMessage",
+ "params" => [ "user1", "we were just talking", "foo\nbar\nbaz\nqux" ],
+ "id" => undef,
+ "array" => [ 1, 1024, 70000, -5, 1e5, 1e7, 1, 0, 3.14, sqrt(2), 1 .. 100 ],
+};
diff --git a/perl/benchmark/deserialize.pl b/perl/benchmark/deserialize.pl
index 634a79e..b1d7fdf 100644
--- a/perl/benchmark/deserialize.pl
+++ b/perl/benchmark/deserialize.pl
@@ -7,12 +7,8 @@ use Storable;
#$Data::MessagePack::PreferInteger = 1;
-my $a = {
- "method" => "handleMessage",
- "params" => [ "user1", "we were just talking" ],
- "id" => undef,
- "array" => [ 1, 1024, 70000, -5, 1e5, 1e7, 1, 0, 3.14, sqrt(2) ],
-};
+my $a = do 'benchmark/data.pl';
+
my $j = JSON::XS::encode_json($a);
my $m = Data::MessagePack->pack($a);
my $s = Storable::freeze($a);
diff --git a/perl/benchmark/serialize.pl b/perl/benchmark/serialize.pl
index e0509ff..3374684 100644
--- a/perl/benchmark/serialize.pl
+++ b/perl/benchmark/serialize.pl
@@ -5,12 +5,7 @@ use JSON::XS;
use Storable;
use Benchmark ':all';
-my $a = {
- "method" => "handleMessage",
- "params" => [ "user1", "we were just talking" ],
- "id" => undef,
- "array" => [ 1, 1024, 70000, -5, 1e5, 1e7, 1, 0, 3.14, sqrt(2) ],
-};
+my $a = do 'benchmark/data.pl';
print "-- serialize\n";
print "JSON::XS: $JSON::XS::VERSION\n";