Peter Makholm > Benchmark-Serialize-0.08 > Benchmark::Serialize

Download:
Benchmark-Serialize-0.08.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.08   Source  

NAME ^

Benchmark::Serialize - Benchmarks of serialization modules

VERSION ^

Version 0.08

SYNOPSIS ^

    use Benchmark::Serialize qw(cmpthese);

    my $structure = {
        array  => [ 'a' .. 'j' ],
        hash   => { 'a' .. 'z' },
        string => 'x' x 200,
    };

    cmpthese( -5, $structure, qw(:core :json :yaml) );

DESCRIPTION ^

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.

Functions

This module provides the following functions

cmpthese(COUNT, STRUCTURE, BENCHMARKS ...)

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.

Benchmark tags

The following tags are supported

:all - All modules with premade benchmarks
:default - A default set of serialization modules
:core - Serialization modules included in core
:json - JSON modules
:yaml - YAML modules
:xml - XML formats

RESULTS ^

See the README file for example results.

AUTHOR ^

Peter Makholm, <peter at makholm.net>

BUGS ^

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.

ACKNOWLEDGEMENTS ^

This module started out as a script written by Christian Hansen, see http://idisk.mac.com/christian.hansen/Public/perl/serialize.pl

COPYRIGHT & LICENSE ^

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.

syntax highlighting: