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::GraphTopologicalSortModules - Benchmark graph topological sort modules

VERSION

This document describes version 0.005 of Bencher::Scenario::GraphTopologicalSortModules (from Perl distribution Bencher-Scenario-GraphTopologicalSortModules), released on 2019-02-15.

SYNOPSIS

To run benchmark with default option:

 % bencher -m GraphTopologicalSortModules

To run module startup overhead benchmark:

 % bencher --module-startup -m GraphTopologicalSortModules

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.

Algorithm::Dependency 1.111

Data::Graph::Util 0.006

Sort::Topological 0.02

BENCHMARK PARTICIPANTS

  • Sort::Topological::toposort (perl_code)

    Code template:

     my $graph = <graph>; Sort::Topological::toposort(sub { @{ $graph->{$_[0]} || [] } }, <unsorted>)
  • Data::Graph::Util::toposort (perl_code)

    Function call template:

     Data::Graph::Util::toposort(<graph>, <unsorted>)
  • Algorithm::Dependency (perl_code)

    Code template:

     my $deps = Algorithm::Dependency::Source::HoA->new(<graph>); my $dep = Algorithm::Dependency->new(source=>$deps); $dep->schedule_all

BENCHMARK DATASETS

  • 2nodes-1edge

  • 6nodes-7edges

  • 10nodes-35edges

  • 100nodes-100edges

  • empty (not included by default)

  • 100nodes-500edges (not included by default)

  • cyclic1 (not included by default)

  • cyclic2 (not included by default)

  • cyclic3 (not included by default)

  • cyclic4 (not included by default)

SAMPLE BENCHMARK RESULTS

Run on: perl: v5.26.1, CPU: Intel(R) Core(TM) M-5Y71 CPU @ 1.20GHz (2 cores), OS: GNU/Linux LinuxMint version 18.3, OS kernel: Linux version 4.10.0-38-generic.

Benchmark with default options (bencher -m GraphTopologicalSortModules):

 #table1#
 +-----------------------------+-------------------+-----------+-----------+------------+---------+---------+
 | participant                 | dataset           | rate (/s) | time (ms) | vs_slowest |  errors | samples |
 +-----------------------------+-------------------+-----------+-----------+------------+---------+---------+
 | Sort::Topological::toposort | 100nodes-100edges |        45 |   22      |          1 | 7.5e-05 |      20 |
 | Sort::Topological::toposort | 10nodes-35edges   |       980 |    1      |         22 | 1.4e-06 |      20 |
 | Algorithm::Dependency       | 100nodes-100edges |       990 |    1      |         22 | 9.3e-06 |      20 |
 | Data::Graph::Util::toposort | 100nodes-100edges |      1300 |    0.76   |         29 | 9.1e-07 |      20 |
 | Algorithm::Dependency       | 6nodes-7edges     |      5500 |    0.18   |        120 | 4.8e-07 |      20 |
 | Data::Graph::Util::toposort | 10nodes-35edges   |      8900 |    0.11   |        200 | 2.7e-07 |      20 |
 | Algorithm::Dependency       | 10nodes-35edges   |      9800 |    0.1    |        220 | 5.3e-07 |      22 |
 | Algorithm::Dependency       | 2nodes-1edge      |     12000 |    0.084  |        270 | 2.2e-07 |      23 |
 | Data::Graph::Util::toposort | 6nodes-7edges     |     19000 |    0.054  |        410 | 1.8e-07 |      21 |
 | Sort::Topological::toposort | 6nodes-7edges     |     24000 |    0.043  |        520 | 1.1e-07 |      20 |
 | Data::Graph::Util::toposort | 2nodes-1edge      |     47000 |    0.021  |       1000 | 4.1e-08 |      34 |
 | Sort::Topological::toposort | 2nodes-1edge      |    150000 |    0.0068 |       3300 | 1.3e-08 |      20 |
 +-----------------------------+-------------------+-----------+-----------+------------+---------+---------+

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

 #table2#
 +-----------------------+-----------+------------------------+------------+---------+---------+
 | participant           | time (ms) | mod_overhead_time (ms) | vs_slowest |  errors | samples |
 +-----------------------+-----------+------------------------+------------+---------+---------+
 | Algorithm::Dependency |      42   |                   28.4 |       1    |   7e-05 |      20 |
 | Sort::Topological     |      24   |                   10.4 |       1.8  | 7.4e-05 |      23 |
 | Data::Graph::Util     |      22.8 |                    9.2 |       1.86 | 2.1e-05 |      20 |
 | perl -e1 (baseline)   |      13.6 |                    0   |       3.12 | 9.9e-06 |      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-GraphTopologicalSortModules.

SOURCE

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

BUGS

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

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