Perl: added benchmark script for memroy-usage

This commit is contained in:
Tokuhiro Matsuno 2009-07-30 13:19:49 +09:00
parent 794adf9469
commit 0fe79a7752

28
perl/benchmark/size.pl Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/perl
use strict;
use warnings;
use Data::MessagePack;
use Storable;
use Text::SimpleTable;
my @entries = (
1,
3.14,
{},
[],
[('a')x10],
{('a')x10},
+{1,+{1,+{}}},
+[+[+[]]],
);
my $table = Text::SimpleTable->new([10, 'storable'], [10, 'msgpack']);
for my $e (@entries) {
$table->row(
length(Storable::nfreeze(ref $e ? $e : \$e)),
length(Data::MessagePack->pack($e)),
);
}
print $table->draw;