=> { 'a' .. 'z' },
string => 'x' x 200,
};
cmpthese( -5, $structure, qw(:core :json :yaml) );
=head1 DESCRIPTION
This module encapsulates some basic benchmarks to help you choose
name attribute:
{
name => 'JSON::XS',
deflate => sub { JSON::XS::encode_json($_[0]) }
inflate => inflate => sub { JSON::XS::decode_json($_[0]) }
}
By default Benchmark::Se
et of serialization modules
=item :core - Serialization modules included in core
=item :json - JSON modules
=item :yaml - YAML modules
=item :xml - XML formats
=back
=cut
use Bench
ark::Serializer::Library::Data::Serializer qw(JSON);
# Register tests on run time
Benchmark::Serializer::Library::Data::Serializer->register('JSON');
=head1 DESCRIPTION
This modules ad
ags
For each added serializer a new Benchmark tag is created called
C<:DS-<nameE<gt>>, i.e C<:DS-JSON> if used as in the synopsis
=cut
sub import {
my $pkg = shift;
my @imports = map {
,
'JSON::PP' => {
deflate => sub { JSON::PP::encode_json($_[0]) },
inflate => sub { JSON::PP::decode_json($_[0]) },
default => 1,
json =>
,
'JSON::XS' => {
deflate => sub { JSON::XS::encode_json($_[0]) },
inflate => sub { JSON::XS::decode_json($_[0]) },
default => 1,
json =>
1
},
'JSON::XS,pretty' => {
deflate => sub { $_[1]->encode( $_[0] ) },
inflate => sub { $_[1]->decode( $_[0] ) },
args => sub { JSON::XS->new->pretty(1)->allow_b