The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bencher::Scenario::ScalarUtilNumeric - Benchmark Scalar::Util::Numeric vs Scalar::Util::Numeric::PP

VERSION

This document describes version 0.02 of Bencher::Scenario::ScalarUtilNumeric (from Perl distribution Bencher-Scenario-ScalarUtilNumeric), released on 2017-01-25.

SYNOPSIS

To run benchmark with default option:

 % bencher -m ScalarUtilNumeric

To run module startup overhead benchmark:

 % bencher --module-startup -m ScalarUtilNumeric

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.

Scalar::Util::Numeric::PP 0.04

Scalar::Util::Numeric 0.40

BENCHMARK PARTICIPANTS

  • isint-int-pp (perl_code) [pp, func:isint]

    Function call template:

     Scalar::Util::Numeric::PP::isint(1)
  • isint-str-pp (perl_code) [pp, func:isint]

    Function call template:

     Scalar::Util::Numeric::PP::isint('a')
  • isint-float-pp (perl_code) [pp, func:isint]

    Function call template:

     Scalar::Util::Numeric::PP::isint(1.23)
  • isfloat-int-pp (perl_code) [pp, func:isfloat]

    Function call template:

     Scalar::Util::Numeric::PP::isfloat(1)
  • isfloat-str-pp (perl_code) [pp, func:isfloat]

    Function call template:

     Scalar::Util::Numeric::PP::isfloat('a')
  • isfloat-float-pp (perl_code) [pp, func:isfloat]

    Function call template:

     Scalar::Util::Numeric::PP::isfloat(1.23)
  • isnum-int-pp (perl_code) [pp, func:isnum]

    Function call template:

     Scalar::Util::Numeric::PP::isnum(1)
  • isnum-str-pp (perl_code) [pp, func:isnum]

    Function call template:

     Scalar::Util::Numeric::PP::isnum('a')
  • isnum-float-pp (perl_code) [pp, func:isnum]

    Function call template:

     Scalar::Util::Numeric::PP::isnum(1.23)
  • isint-int-xs (perl_code) [xs, func:isint]

    Function call template:

     Scalar::Util::Numeric::isint(1)
  • isint-str-xs (perl_code) [xs, func:isint]

    Function call template:

     Scalar::Util::Numeric::isint('a')
  • isint-float-xs (perl_code) [xs, func:isint]

    Function call template:

     Scalar::Util::Numeric::isint(1.23)
  • isfloat-int-xs (perl_code) [xs, func:isfloat]

    Function call template:

     Scalar::Util::Numeric::isfloat(1)
  • isfloat-str-xs (perl_code) [xs, func:isfloat]

    Function call template:

     Scalar::Util::Numeric::isfloat('a')
  • isfloat-float-xs (perl_code) [xs, func:isfloat]

    Function call template:

     Scalar::Util::Numeric::isfloat(1.23)
  • isnum-int-xs (perl_code) [xs, func:isnum]

    Function call template:

     Scalar::Util::Numeric::isnum(1)
  • isnum-str-xs (perl_code) [xs, func:isnum]

    Function call template:

     Scalar::Util::Numeric::isnum('a')
  • isnum-float-xs (perl_code) [xs, func:isnum]

    Function call template:

     Scalar::Util::Numeric::isnum(1.23)

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 default options (bencher -m ScalarUtilNumeric):

 #table1#
 +------------------+-----------+-----------+------------+---------+---------+
 | participant      | rate (/s) | time (μs) | vs_slowest |  errors | samples |
 +------------------+-----------+-----------+------------+---------+---------+
 | isnum-float-pp   |    455464 |   2.19556 |      1     |   0     |      24 |
 | isnum-str-pp     |    580500 |   1.723   |      1.275 | 1.5e-10 |      30 |
 | isfloat-int-pp   |    850000 |   1.2     |      1.9   | 1.7e-09 |      20 |
 | isfloat-float-pp |    930000 |   1.1     |      2     | 1.7e-09 |      20 |
 | isfloat-str-pp   |   1030000 |   0.968   |      2.27  | 7.4e-10 |      22 |
 | isint-float-pp   |   1220000 |   0.818   |      2.68  | 5.2e-10 |      20 |
 | isnum-int-pp     |   1500000 |   0.668   |      3.28  |   2e-10 |      21 |
 | isint-int-pp     |   1900000 |   0.52    |      4.2   | 8.3e-10 |      20 |
 | isfloat-float-xs |   2600000 |   0.385   |      5.71  | 1.8e-10 |      28 |
 | isnum-float-xs   |   2610000 |   0.383   |      5.73  | 2.5e-10 |      20 |
 | isint-str-pp     |   2740000 |   0.365   |      6.02  | 2.1e-10 |      20 |
 | isint-float-xs   |   2800000 |   0.36    |      6.1   | 2.1e-09 |      20 |
 | isint-int-xs     |   9000000 |   0.1     |     20     | 6.1e-09 |      20 |
 | isint-str-xs     |  15000000 |   0.066   |     33     |   4e-10 |      20 |
 | isfloat-int-xs   |  15800000 |   0.0631  |     34.8   | 4.6e-11 |      20 |
 | isfloat-str-xs   |  15900000 |   0.0628  |     34.9   | 4.6e-11 |      20 |
 | isnum-int-xs     |  15900000 |   0.0627  |     35     | 4.6e-11 |      20 |
 | isnum-str-xs     |  16000000 |   0.0625  |     35.1   | 4.7e-11 |      21 |
 +------------------+-----------+-----------+------------+---------+---------+

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

 #table2#
 +---------------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+
 | participant               | proc_private_dirty_size (kB) | proc_rss_size (MB) | proc_size (MB) | time (ms) | mod_overhead_time (ms) | vs_slowest |  errors | samples |
 +---------------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+
 | Scalar::Util::Numeric     | 964                          | 4.3                | 16             |      12   |                    6.3 |        1   | 7.3e-05 |      20 |
 | Scalar::Util::Numeric::PP | 964                          | 4.4                | 16             |       9.1 |                    3.4 |        1.3 | 3.9e-05 |      20 |
 | perl -e1 (baseline)       | 964                          | 4.4                | 16             |       5.7 |                    0   |        2   | 1.9e-05 |      20 |
 +---------------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+

To display as an interactive HTML table on a browser, you can add option --format html+datatables.

HOMEPAGE

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

SOURCE

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

BUGS

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

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) 2017 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.