| Benchmark-Serialize documentation | Contained in the Benchmark-Serialize distribution. |
Benchmark::Serialize::Library::ProtocolBuffers::XS - Protobuf/XS benchmarks
# 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');
This module adds benchmarks to Benchmark::Serialize for serializers created with Protocol Buffers for Perl/XS.
Peter Makholm, <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.
Copyright 2009-2010 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.
| 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;