NAME

Bencher::Scenario::URIEscaping - Benchmark URI escaping using various modules

VERSION

This document describes version 0.003 of Bencher::Scenario::URIEscaping (from Perl distribution Bencher-Scenario-URIEscaping), released on 2016-06-17.

SYNOPSIS

To run benchmark with default option:

% bencher -m URIEscaping

To run module startup overhead benchmark:

% bencher --module-startup -m URIEscaping

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

BENCHMARKED MODULES

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

URI::Escape 3.31

URI::XSEscape 0.000007

URI::Escape::XS 0.14

URI::Encode 1.1.1

URI::Encode::XS 0.08

BENCHMARK PARTICIPANTS

  • URI::Escape::uri_escape (perl_code) [escape]

    Function call template:

    URI::Escape::uri_escape(<str>)
  • URI::Escape::uri_escape_utf8 (perl_code) [escape, utf8]

    Function call template:

    URI::Escape::uri_escape_utf8(<str>)
  • URI::Escape::uri_unescape (perl_code) [unescape]

    Function call template:

    URI::Escape::uri_unescape(<str>)
  • URI::XSEscape::uri_escape (perl_code) [escape]

    Function call template:

    URI::XSEscape::uri_escape(<str>)
  • URI::XSEscape::uri_escape_utf8 (perl_code) [escape, utf8]

    Function call template:

    URI::XSEscape::uri_escape_utf8(<str>)
  • URI::XSEscape::uri_unescape (perl_code) [unescape]

    Function call template:

    URI::XSEscape::uri_unescape(<str>)
  • URI::Escape::XS::uri_escape (perl_code) [escape]

    Function call template:

    URI::Escape::XS::uri_escape(<str>)
  • URI::Escape::XS::uri_unescape (perl_code) [unescape]

    Function call template:

    URI::Escape::XS::uri_unescape(<str>)
  • URI::Encode::uri_encode (perl_code) [escape]

    Function call template:

    URI::Encode::uri_encode(<str>)
  • URI::Encode::uri_decode (perl_code) [unescape]

    Function call template:

    URI::Encode::uri_decode(<str>)
  • URI::Encode::XS::uri_encode (perl_code) [escape]

    Function call template:

    URI::Encode::XS::uri_encode(<str>)
  • URI::Encode::XS::uri_decode (perl_code) [unescape]

    Function call template:

    URI::Encode::XS::uri_decode(<str>)

BENCHMARK DATASETS

  • empty [escape]

  • ascii53 [escape]

  • utf36 [escape, utf8]

  • u_ascii53 [unescape]

  • ascii66 [escape]

  • u_ascii66 [unescape]

SAMPLE BENCHMARK RESULTS

Run on: perl: v5.22.1, CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz (4 cores), OS: GNU/Linux Debian version 8.0, OS kernel: Linux version 3.16.0-4-amd64.

Benchmark with default options (bencher -m URIEscaping):

+--------------------------------+-----------+-----------+-----------+------------+---------+---------+
| participant                    | dataset   | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+--------------------------------+-----------+-----------+-----------+------------+---------+---------+
| URI::Encode::uri_decode        | u_ascii53 |      2330 |  429      |       1    | 4.1e-07 |      28 |
| URI::Encode::uri_encode        | ascii53   |      2340 |  427      |       1    | 4.3e-07 |      20 |
| URI::Encode::uri_encode        | ascii66   |      2410 |  416      |       1.03 | 2.1e-07 |      20 |
| URI::Encode::uri_decode        | u_ascii66 |      2410 |  415      |       1.03 | 4.1e-07 |     208 |
| URI::Encode::uri_encode        | empty     |      2470 |  404      |       1.06 | 2.1e-07 |      20 |
| URI::Escape::uri_escape_utf8   | ascii53   |     82000 |   12.2    |      35.1  | 3.3e-09 |      20 |
| URI::Escape::uri_escape        | ascii53   |     85700 |   11.7    |      36.8  | 1.1e-08 |     136 |
| URI::Escape::uri_escape_utf8   | utf36     |     96000 |   10      |      41    |   1e-08 |     166 |
| URI::Escape::uri_escape_utf8   | ascii66   |    117000 |    8.54   |      50.2  | 3.1e-09 |      23 |
| URI::Escape::uri_unescape      | u_ascii53 |    120000 |    8.5    |      50    | 8.6e-09 |     192 |
| URI::Escape::uri_escape        | ascii66   |    120000 |    8.1    |      53    | 8.1e-09 |     215 |
| URI::Escape::uri_unescape      | u_ascii66 |    180000 |    5.5    |      77    | 5.6e-09 |      28 |
| URI::Escape::uri_escape_utf8   | empty     |    900000 |    1.1    |     390    | 1.2e-09 |     155 |
| URI::Escape::uri_escape        | empty     |   1310000 |    0.765  |     561    | 7.6e-10 |     150 |
| URI::Escape::XS::uri_escape    | ascii66   |   1340000 |    0.748  |     573    | 4.2e-10 |      20 |
| URI::Escape::XS::uri_escape    | ascii53   |   1350000 |    0.738  |     581    |   4e-10 |      22 |
| URI::XSEscape::uri_escape_utf8 | ascii66   |   1380000 |    0.726  |     590    | 4.1e-10 |      21 |
| URI::XSEscape::uri_escape_utf8 | ascii53   |   1400000 |    0.714  |     601    | 3.8e-10 |      25 |
| URI::XSEscape::uri_escape_utf8 | utf36     |   1600000 |    0.64   |     670    | 6.9e-10 |     307 |
| URI::Escape::XS::uri_unescape  | u_ascii53 |   1600000 |    0.626  |     684    | 6.3e-10 |      20 |
| URI::Escape::XS::uri_escape    | empty     |   1670000 |    0.6    |     715    | 2.1e-10 |      20 |
| URI::Escape::XS::uri_unescape  | u_ascii66 |   1840000 |    0.542  |     791    | 2.1e-10 |      20 |
| URI::XSEscape::uri_escape_utf8 | empty     |   1900000 |    0.52   |     830    |   6e-10 |      22 |
| URI::XSEscape::uri_unescape    | u_ascii53 |   2700000 |    0.36   |    1200    | 3.9e-10 |      93 |
| URI::XSEscape::uri_escape      | ascii66   |   2820000 |    0.355  |    1210    | 4.5e-11 |      20 |
| URI::XSEscape::uri_escape      | ascii53   |   2920000 |    0.343  |    1250    | 1.9e-10 |      26 |
| URI::XSEscape::uri_unescape    | u_ascii66 |   2900000 |    0.34   |    1300    | 4.2e-10 |      78 |
| URI::Encode::XS::uri_decode    | u_ascii66 |   4700000 |    0.213  |    2020    | 1.1e-10 |      20 |
| URI::XSEscape::uri_escape      | empty     |   5400000 |    0.19   |    2300    | 2.6e-10 |      81 |
| URI::Encode::XS::uri_decode    | u_ascii53 |   5720000 |    0.175  |    2450    | 4.5e-11 |      20 |
| URI::Encode::XS::uri_encode    | ascii66   |   7370000 |    0.136  |    3160    |   1e-10 |      26 |
| URI::Encode::XS::uri_encode    | ascii53   |   7850000 |    0.127  |    3370    | 3.9e-11 |      20 |
| URI::Encode::XS::uri_encode    | empty     |  13400000 |    0.0745 |    5760    | 6.5e-11 |      20 |
+--------------------------------+-----------+-----------+-----------+------------+---------+---------+

Benchmark module startup overhead (bencher -m URIEscaping --module-startup):

+---------------------+-----------+------------------------+------------+---------+---------+
| participant         | time (ms) | mod_overhead_time (ms) | vs_slowest |  errors | samples |
+---------------------+-----------+------------------------+------------+---------+---------+
| URI::Encode         | 19.2      |                  14.5  | 1          | 1.9e-05 |     723 |
| URI::Escape         | 11.6      |                   6.9  | 1.65       | 1.1e-05 |    1557 |
| URI::Escape::XS     | 9.26      |                   4.56 | 2.07       | 8.8e-06 |     805 |
| URI::XSEscape       | 9.11      |                   4.41 | 2.1        | 8.8e-06 |     596 |
| URI::Encode::XS     | 8.2       |                   3.5  | 2.34       | 8.1e-06 |     824 |
| perl -e1 (baseline) | 4.7       |                   0    | 4.08       | 4.7e-06 |    5156 |
+---------------------+-----------+------------------------+------------+---------+---------+

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.

HOMEPAGE

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

SOURCE

Source repository is at https://github.com/perlancar/perl-Bencher-Scenario-URIEscaping.

BUGS

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

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.