NAME

Bencher::Scenario::JSONDecodeRegexp - Benchmark JSON decoding

VERSION

This document describes version 0.002 of Bencher::Scenario::JSONDecodeRegexp (from Perl distribution Bencher-Scenarios-JSONDecodeRegexp), released on 2016-11-04.

SYNOPSIS

To run benchmark with default option:

% bencher -m JSONDecodeRegexp

To run module startup overhead benchmark:

% bencher --module-startup -m JSONDecodeRegexp

For more options (dump scenario, list/include/exclude/add participants, list/include/exclude/add datasets, etc), see bencher or run bencher --help.

DESCRIPTION

Packaging a benchmark script as a Bencher scenario makes it convenient to include/exclude/add participants/datasets (either via CLI or Perl code), send the result to a central repository, among others . See Bencher and bencher (CLI) for more details.

BENCHMARKED MODULES

Version numbers shown below are the versions used when running the sample benchmark.

JSON::Decode::Regexp 0.09

JSON::PP 2.27300

BENCHMARK PARTICIPANTS

  • JSON::Decode::Regexp::from_json (perl_code)

    Function call template:

    JSON::Decode::Regexp::from_json(<data>)
  • JSON::PP::decode (perl_code)

    Code template:

    state $json = JSON::PP->new->allow_nonref; $json->decode(<data>)

BENCHMARK DATASETS

  • str-a

    a 100-character string with some escape sequences

  • array0

  • array1

  • array10

  • array100

  • hash0

  • hash1

  • hash10

  • hash100

SAMPLE BENCHMARK RESULTS

Run on: perl: v5.24.0, CPU: Intel(R) Core(TM) M-5Y71 CPU @ 1.20GHz (2 cores), OS: GNU/Linux LinuxMint version 17.3, OS kernel: Linux version 3.19.0-32-generic.

Benchmark with bencher -m JSONDecodeRegexp --include-path archive/JSON-Decode-Regexp-0.03/lib --include-path archive/JSON-Decode-Regexp-0.04/lib --include-path archive/JSON-Decode-Regexp-0.06/lib --include-path archive/JSON-Decode-Regexp-0.07/lib --include-path archive/JSON-Decode-Regexp-0.09/lib --multimodver JSON::Decode::Regexp:

#table1#
{dataset=>"array0"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.06   |     11000 |     89    |        1   | 1.1e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.03   |     17000 |     57    |        1.5 | 2.9e-07 |      29 |
| JSON::Decode::Regexp::from_json | 0.04   |     18000 |     54    |        1.6 | 1.9e-07 |      31 |
| JSON::Decode::Regexp::from_json | 0.09   |    200000 |      6    |       20   | 1.1e-07 |      20 |
| JSON::PP::decode                |        |    240000 |      4.2  |       21   | 6.7e-09 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |    281000 |      3.55 |       25   | 1.6e-09 |      22 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table2#
{dataset=>"array1"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.06   |      5100 |    200    |        1   | 3.7e-07 |      26 |
| JSON::Decode::Regexp::from_json | 0.03   |     14000 |     73    |        2.7 | 6.7e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.04   |     16000 |     62    |        3.2 |   5e-07 |      25 |
| JSON::Decode::Regexp::from_json | 0.09   |    100000 |      8    |       20   | 3.4e-07 |      20 |
| JSON::PP::decode                |        |    133000 |      7.53 |       26.2 | 3.3e-09 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |    190000 |      5.4  |       37   | 6.7e-09 |      20 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table3#
{dataset=>"array10"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.03   |      7600 |     130   |       1    | 2.4e-07 |      24 |
| JSON::Decode::Regexp::from_json | 0.06   |      7800 |     130   |       1    | 2.7e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.04   |     13000 |      77.1 |       1.7  | 2.5e-08 |      22 |
| JSON::Decode::Regexp::from_json | 0.09   |     30000 |      40   |       4    | 1.5e-06 |      20 |
| JSON::PP::decode                |        |     28000 |      35   |       3.7  | 4.9e-08 |      24 |
| JSON::Decode::Regexp::from_json | 0.07   |     41000 |      24.4 |       5.38 | 6.7e-09 |      20 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table4#
{dataset=>"array100"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.03   |      1300 |       780 |       1    | 1.1e-06 |      20 |
| JSON::PP::decode                |        |      2000 |       500 |       2    | 1.9e-05 |      23 |
| JSON::Decode::Regexp::from_json | 0.06   |      3100 |       330 |       2.4  | 4.7e-07 |      21 |
| JSON::Decode::Regexp::from_json | 0.09   |      3700 |       270 |       2.8  | 1.1e-06 |      20 |
| JSON::Decode::Regexp::from_json | 0.04   |      3820 |       262 |       2.97 | 2.1e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |      4700 |       210 |       3.6  | 2.7e-07 |      20 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table5#
{dataset=>"hash0"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.06   |     10000 |        99 |        1   | 2.9e-07 |      28 |
| JSON::Decode::Regexp::from_json | 0.03   |     17000 |        58 |        1.7 | 5.5e-07 |      21 |
| JSON::Decode::Regexp::from_json | 0.04   |     19000 |        53 |        1.9 | 1.1e-07 |      20 |
| JSON::PP::decode                |        |    250000 |         4 |       25   | 6.7e-09 |      20 |
| JSON::Decode::Regexp::from_json | 0.09   |    330000 |         3 |       33   | 3.3e-09 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |    340000 |         3 |       33   | 1.4e-08 |      31 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table6#
{dataset=>"hash1"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.04   |      7100 |     140   |        1   | 6.7e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.06   |      8000 |     120   |        1.1 |   6e-07 |      27 |
| JSON::Decode::Regexp::from_json | 0.03   |     10000 |     100   |        1   | 2.3e-06 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |     75000 |      13   |       11   | 5.3e-08 |      23 |
| JSON::PP::decode                |        |    100000 |       9.7 |       14   | 1.4e-08 |      30 |
| JSON::Decode::Regexp::from_json | 0.09   |    120000 |       8.4 |       17   |   3e-08 |      20 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table7#
{dataset=>"hash10"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.03   |      4300 |       230 |        1   | 2.2e-06 |      20 |
| JSON::Decode::Regexp::from_json | 0.06   |      4600 |       220 |        1.1 | 9.3e-07 |      29 |
| JSON::Decode::Regexp::from_json | 0.04   |      6000 |       170 |        1.4 | 1.3e-06 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |     11000 |        95 |        2.4 | 1.8e-07 |      21 |
| JSON::PP::decode                |        |     17000 |        60 |        3.8 | 1.1e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.09   |     19000 |        52 |        4.4 |   1e-07 |      22 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table8#
{dataset=>"hash100"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (ms) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.03   |       400 |     2     |       1    | 2.6e-05 |      20 |
| JSON::Decode::Regexp::from_json | 0.06   |      1000 |     1     |       2    | 1.2e-05 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |      1090 |     0.918 |       2.61 | 9.1e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.04   |      1100 |     0.9   |       2.7  | 1.3e-06 |      20 |
| JSON::PP::decode                |        |      1500 |     0.66  |       3.6  | 1.2e-06 |      20 |
| JSON::Decode::Regexp::from_json | 0.09   |      2100 |     0.49  |       4.9  | 1.1e-06 |      20 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

#table9#
{dataset=>"str-a"}
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| participant                     | modver | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+
| JSON::Decode::Regexp::from_json | 0.06   |      9100 |     110   |        1   |   4e-07 |      23 |
| JSON::Decode::Regexp::from_json | 0.04   |     13000 |      75   |        1.5 | 3.2e-07 |      20 |
| JSON::Decode::Regexp::from_json | 0.03   |     14000 |      71   |        1.5 | 2.1e-07 |      20 |
| JSON::PP::decode                |        |     16300 |      61.2 |        1.8 | 2.7e-08 |      20 |
| JSON::Decode::Regexp::from_json | 0.07   |     50000 |      20   |        6   | 8.1e-07 |      28 |
| JSON::Decode::Regexp::from_json | 0.09   |    100000 |       9.8 |       11   | 1.7e-08 |      20 |
+---------------------------------+--------+-----------+-----------+------------+---------+---------+

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Bencher-Scenarios-JSONDecodeRegexp.

SOURCE

Source repository is at https://github.com/perlancar/perl-Bencher-Scenarios-JSONDecodeRegexp.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenarios-JSONDecodeRegexp

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.