NAME

Bencher::Scenario::GraphTopologicalSortModules - Benchmark graph topological sort modules

VERSION

This document describes version 0.004 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.005

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

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 |     160   | 6.4       |       1    | 1.2e-05 |      20 |
| Sort::Topological::toposort | 10nodes-35edges   |     940   | 1.1       |       6    |   4e-06 |      22 |
| Algorithm::Dependency       | 100nodes-100edges |     970   | 1         |       6.2  | 2.5e-06 |      20 |
| Data::Graph::Util::toposort | 100nodes-100edges |    4600   | 0.22      |      29    | 4.3e-07 |      20 |
| Algorithm::Dependency       | 10nodes-35edges   |    9900   | 0.1       |      63    | 1.3e-07 |      20 |
| Algorithm::Dependency       | 6nodes-7edges     |   21000   | 0.048     |     130    | 5.3e-08 |      20 |
| Sort::Topological::toposort | 6nodes-7edges     |   23422.3 | 0.0426943 |     149.59 | 1.2e-11 |      20 |
| Data::Graph::Util::toposort | 10nodes-35edges   |   34300   | 0.0292    |     219    | 1.3e-08 |      20 |
| Algorithm::Dependency       | 2nodes-1edge      |   45000   | 0.022     |     290    |   8e-08 |      20 |
| Data::Graph::Util::toposort | 6nodes-7edges     |   65900   | 0.0152    |     421    | 6.7e-09 |      20 |
| Sort::Topological::toposort | 2nodes-1edge      |  138000   | 0.00725   |     880    | 3.3e-09 |      20 |
| Data::Graph::Util::toposort | 2nodes-1edge      |  160000   | 0.0062    |    1000    | 2.2e-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 |      13   |                    7.7 |        1   | 3.6e-05 |      21 |
| Data::Graph::Util     |       8.1 |                    2.8 |        1.7 | 2.9e-05 |      20 |
| Sort::Topological     |       8.1 |                    2.8 |        1.7 |   3e-05 |      20 |
| perl -e1 (baseline)   |       5.3 |                    0   |        2.6 |   2e-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-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.