JSON-SL

 view release on metacpan or  search on metacpan

eg/bench.pl  view on Meta::CPAN

use JSON::SL;
use Data::Dumper::Concise;
use JSON::XS qw(decode_json);
use Getopt::Long;
use Benchmark qw(:all);
use Carp qw(confess);

$SIG{__DIE__} = \&confess;

GetOptions(
    'i|iterations=i' => \my $Iterations,
    'x|jsonxs' => \my $TestJsonxs,
    's|jsonsl' => \my $TestJsonsl,
    'j|jpr' => \my $TestJsonpointer,
    'c|chunked=i' => \my $TestChunks,
    'f|file=s'  => \my $TESTFILE,
    'r|recursion=i' => \my $RecursionLimit,
    'd|dump'    => \my $DumpTree,
    'U|no-unescape' => \my $DontUnescape,
    'h|help' => \my $PrintHelp
);

if ($PrintHelp) {
    print STDERR <<EOF;
$0 [options]
    -i --iterations=NUM Number of iterations
    -x --jsonxs             Benchmark JSON::XS
    -s --jsonsl             Benchmark JSON::SL
    -j --jpr                Test JSONPointer functionality
    -f --file=FILE          Run benchmarks on FILE
    -c --chunked=SIZE       Test incremental chunks of SIZE bytes
    -r --recursion=LEVEL    Set JSON::SL recursion limit
    -d --dump               Dump object tree on completion
    -U --no-unescape        Don't have JSON::SL unescape strings
EOF
    exit(1);

eg/tuba.pl  view on Meta::CPAN

use strict;
use warnings;
use blib;
use JSON::SL::Tuba;
use Getopt::Long;
use Data::Dumper::Concise;
use utf8;

GetOptions('f|file=s' => \my $InputFile,
           'c|chunk=i' => \my $ChunkSize,
           'i|iterations=i' => \my $Iterations,
           'a|accumulate' => \my $AccumAll,
           'q|quiet' => \my $Silent);

our @ISA = qw(JSON::SL::Tuba);
my $JSON;

$Iterations ||= 1;

if ($InputFile) {
    open my $fh, "<", $InputFile or die "$InputFile: $!";



( run in 0.654 second using v1.01-cache-2.11-cpan-71847e10f99 )