mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-19 04:52:59 +01:00
Perl: added benchmark script for memroy-usage
This commit is contained in:
parent
794adf9469
commit
0fe79a7752
28
perl/benchmark/size.pl
Normal file
28
perl/benchmark/size.pl
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user