NAME

Bencher::Scenario::ListMoreUtils - Benchmark List::MoreUtils::PP vs List::MoreUtils::XS

VERSION

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

SYNOPSIS

To run benchmark with default option:

 % bencher -m ListMoreUtils

To run module startup overhead benchmark:

 % bencher --module-startup -m ListMoreUtils

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

DESCRIPTION

EARLY VERSION, ONLY A FEW FUNCTIONS HAVE BEEN BENCHMARKED.

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.

List::MoreUtils::PP 0.416

List::MoreUtils::XS 0.416

BENCHMARK PARTICIPANTS

  • List::MoreUtils::PP::uniq (perl_code) [arg1]

    Function call template:

     List::MoreUtils::PP::uniq(@{<list>})
  • List::MoreUtils::XS::uniq (perl_code) [arg1]

    Code template:

     List::MoreUtils::uniq(@{<list>})
  • List::MoreUtils::PP::minmax (perl_code) [arg1]

    Function call template:

     List::MoreUtils::PP::minmax(@{<list>})
  • List::MoreUtils::XS::minmax (perl_code) [arg1]

    Code template:

     List::MoreUtils::minmax(@{<list>})
  • List::MoreUtils::PP::firstidx (perl_code) [arg1]

    Code template:

     List::MoreUtils::PP::firstidx(sub{$_==-1}, @{<list>})
  • List::MoreUtils::XS::firstidx (perl_code) [arg1]

    Code template:

     List::MoreUtils::firstidx(sub{$_==-1}, @{<list>})

BENCHMARK DATASETS

  • num10

  • num100

  • num1000

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 ListMoreUtils):

 #table1#
 +-------------------------------+---------+------------+-----------+------------+---------+---------+
 | participant                   | dataset | rate (/s)  | time (μs) | vs_slowest |  errors | samples |
 +-------------------------------+---------+------------+-----------+------------+---------+---------+
 | List::MoreUtils::PP::firstidx | num1000 |    2772.81 |  360.645  |     1      | 4.4e-11 |      20 |
 | List::MoreUtils::PP::uniq     | num1000 |    3100    |  330      |     1.1    |   1e-06 |      33 |
 | List::MoreUtils::XS::uniq     | num1000 |    3740    |  268      |     1.35   | 2.1e-07 |      20 |
 | List::MoreUtils::PP::minmax   | num1000 |    5700    |  170      |     2.1    | 2.1e-07 |      21 |
 | List::MoreUtils::XS::firstidx | num1000 |   23515    |   42.527  |     8.4805 | 4.6e-11 |      20 |
 | List::MoreUtils::PP::firstidx | num100  |   28000    |   35      |    10      | 2.4e-07 |      20 |
 | List::MoreUtils::XS::minmax   | num1000 |   35239    |   28.378  |    12.709  | 4.7e-11 |      20 |
 | List::MoreUtils::PP::uniq     | num100  |   37023    |   27.01   |    13.352  | 4.6e-11 |      21 |
 | List::MoreUtils::PP::minmax   | num100  |   56200    |   17.8    |    20.3    |   5e-09 |      36 |
 | List::MoreUtils::XS::uniq     | num100  |   57000    |   18      |    20      | 2.6e-08 |      21 |
 | List::MoreUtils::XS::firstidx | num100  |  205360    |    4.8695 |    74.063  | 4.6e-11 |      24 |
 | List::MoreUtils::PP::firstidx | num10   |  272900    |    3.664  |    98.42   | 4.9e-11 |      25 |
 | List::MoreUtils::PP::uniq     | num10   |  282000    |    3.54   |   102      | 1.6e-09 |      21 |
 | List::MoreUtils::XS::minmax   | num100  |  350000    |    2.86   |   126      | 8.5e-10 |      21 |
 | List::MoreUtils::PP::minmax   | num10   |  459000    |    2.18   |   166      | 6.9e-10 |      29 |
 | List::MoreUtils::XS::uniq     | num10   |  544390    |    1.8369 |   196.33   | 1.2e-11 |      25 |
 | List::MoreUtils::XS::firstidx | num10   | 1340000    |    0.744  |   485      | 3.9e-10 |      23 |
 | List::MoreUtils::XS::minmax   | num10   | 2000000    |    0.49   |   730      | 5.8e-10 |      23 |
 +-------------------------------+---------+------------+-----------+------------+---------+---------+

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

 #table2#
 +---------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+
 | participant         | proc_private_dirty_size (MB) | proc_rss_size (MB) | proc_size (MB) | time (ms) | mod_overhead_time (ms) | vs_slowest |  errors | samples |
 +---------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+
 | List::MoreUtils::PP | 0.97                         | 4.4                | 18             |      10   |                    4.3 |        1   | 5.9e-05 |      20 |
 | List::MoreUtils::XS | 1.2                          | 4.5                | 16             |       9.2 |                    3.5 |        1.1 | 2.3e-05 |      20 |
 | perl -e1 (baseline) | 1.2                          | 4.5                | 16             |       5.7 |                    0   |        1.8 | 2.3e-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-ListMoreUtils.

SOURCE

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

BUGS

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

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.