Benchmark::Serialize - Benchmarks of serialization modules
Version 0.08
use Benchmark::Serialize qw(cmpthese); my $structure = { array => [ 'a' .. 'j' ], hash => { 'a' .. 'z' }, string => 'x' x 200, }; cmpthese( -5, $structure, qw(:core :json :yaml) );
This module encapsulates some basic benchmarks to help you choose a module for serializing data. Note that using this module is only a part of chosing a serialization format. Other factors than the benchmarked might be of relevance!
Included is support for 24 different serialization modules. Also supported is the Data::Serializer wrapper providing a unified interface for serialization and some extra features. Benchmarking of specialized modules made with Protocol Buffers for Perl/XS (protobuf-perlxs) is also available.
This module provides the following functions
Benchmark COUNT interations of a list of modules. A benchmark is either a name of a supported module, a tag, or a hash ref containing at least an inflate, a deflate, and a name attribute:
{ name => 'JSON::XS', deflate => sub { JSON::XS::encode_json($_[0]) } inflate => inflate => sub { JSON::XS::decode_json($_[0]) } }
By default Benchmark::Serialize will try to use the name attribute as a module to be loaded. This can be overridden by having a packages attribute with an arrayref containing modules to be loaded.
The following tags are supported
See the README file for example results.
Peter Makholm, <peter at makholm.net>
<peter at makholm.net>
Please report any bugs or feature requests to bug-benchmark-serialize at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Benchmark-Serialize. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-benchmark-serialize at rt.cpan.org
This module started out as a script written by Christian Hansen, see http://idisk.mac.com/christian.hansen/Public/perl/serialize.pl
Copyright 2009 Peter Makholm.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Benchmark::Serialize, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Benchmark::Serialize
CPAN shell
perl -MCPAN -e shell install Benchmark::Serialize
For more information on module installation, please visit the detailed CPAN module installation guide.