Benchmark::Serialize::Library::ProtocolBuffers::XS - Protobuf/XS benchmarks


Benchmark-Serialize documentation Contained in the Benchmark-Serialize distribution.

Index


Code Index:

NAME

Top

Benchmark::Serialize::Library::ProtocolBuffers::XS - Protobuf/XS benchmarks

SYNOPSIS

Top

    # Register tests on use time
    use Benchmark::Serializer::Library::ProtocolBuffers::XS qw(Person);

    # Register tests on run time
    Benchmark::Serializer::Library::ProtocolBuffers::XS->register('Person');




DESCRIPTION

Top

This module adds benchmarks to Benchmark::Serialize for serializers created with Protocol Buffers for Perl/XS.

Benchmark tags

Top

All benchmarks created by this module will have the benchmark tag :ProtocolBuffers

SEE ALSO

Top

http://code.google.com/p/protobuf-perlxs/

AUTHOR

Top

Peter Makholm, <peter at makholm.net>

BUGS

Top

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.

COPYRIGHT & LICENSE

Top


Benchmark-Serialize documentation Contained in the Benchmark-Serialize distribution.
package Benchmark::Serialize::Library::ProtocolBuffers::XS;

use strict;
use warnings;

use Benchmark::Serialize::Library;
use Scalar::Util qw(blessed);

sub import {
    my $pkg     = shift;
    my @imports = @_;

    for my $class (@imports) {
        Benchmark::Serialize::Library->register(
            $class => {
                deflate         => sub { $class->new($_[0])->pack },
                inflate         => sub { $class->new($_[0])->to_hashref },
                ProtocolBuffers => 1,
            }
        );
    }
}

sub register {
    my $pkg = shift;

    $pkg->import( @_ );
}


1;