NAME
Bencher::Scenario::TreeObject::Build - Benchmark tree building using Tree::Create::Size
VERSION
This document describes version 0.05 of Bencher::Scenario::TreeObject::Build (from Perl distribution Bencher-Scenarios-TreeObject), released on 2017-01-25.
SYNOPSIS
To run benchmark with default option:
% bencher -m TreeObject::Build
To run module startup overhead benchmark:
% bencher --module-startup -m TreeObject::Build
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.
Tree::Object::Array 0.07
Tree::Object::Array::Glob 0.07
Tree::Object::Hash 0.07
Tree::Object::Hash::ChildrenAsList 0.07
Tree::ObjectXS::Hash 0.02
BENCHMARK PARTICIPANTS
Tree::Object::Array (perl_code)
Code template:
Tree::Create::Size::create_tree(height => <height>, num_children => <num_children>, class => 'My::Tree::Object::Array')
Tree::Object::Array::Glob (perl_code)
Code template:
Tree::Create::Size::create_tree(height => <height>, num_children => <num_children>, class => 'My::Tree::Object::Array::Glob')
Tree::Object::Hash (perl_code)
Code template:
Tree::Create::Size::create_tree(height => <height>, num_children => <num_children>, class => 'Tree::Object::Hash')
Tree::Object::Hash::ChildrenAsList (perl_code)
Code template:
Tree::Create::Size::create_tree(height => <height>, num_children => <num_children>, class => 'Tree::Object::Hash::ChildrenAsList')
Tree::Object::InsideOut (perl_code)
Code template:
Tree::Create::Size::create_tree(height => <height>, num_children => <num_children>, class => 'Tree::Object::InsideOut')
Tree::ObjectXS::Array (perl_code)
Code template:
Tree::Create::Size::create_tree(height => <height>, num_children => <num_children>, class => 'My::Tree::ObjectXS::Array')
Tree::ObjectXS::Hash (perl_code)
Code template:
Tree::Create::Size::create_tree(height => <height>, num_children => <num_children>, class => 'Tree::ObjectXS::Hash')
BENCHMARK DATASETS
tiny1 (3 nodes)
A tree with height=1 and 2 children per non-leaf nodes, nodes=1 + 2 = 3
small1 (31 nodes)
A tree with height=4 and 2 children per non-leaf nodes, nodes=1 + 2 + 4 + 8 + 16 = 31
small2 (364 nodes)
A tree with height=5 and 3 children per non-leaf nodes, nodes=1 + 3 + 9 + 27 + 81 + 243 = 364
small3 (1365 nodes)
A tree with height=5 and 4 children per non-leaf nodes, nodes=1 + 4 + 16 + 64 + 256 + 1024 = 1365
medium1 (19531 nodes)
A tree with height=6 and 5 children per non-leaf nodes, nodes=1 + 5 + 25 + 125 + 625 + 3125 + 15625 = 19531
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 bencher -m TreeObject::Build --include-datasets 'small1 (31 nodes)'
:
#table1#
+------------------------------------+-----------+-----------+------------+---------+---------+
| participant | rate (/s) | time (μs) | vs_slowest | errors | samples |
+------------------------------------+-----------+-----------+------------+---------+---------+
| Tree::Object::InsideOut | 8400 | 120 | 1 | 6.9e-07 | 20 |
| Tree::Object::Hash::ChildrenAsList | 14000 | 73 | 1.6 | 2.1e-07 | 20 |
| Tree::Object::Hash | 14000 | 72 | 1.6 | 2.1e-07 | 20 |
| Tree::Object::Array::Glob | 15000 | 66 | 1.8 | 1.3e-07 | 21 |
| Tree::Object::Array | 17000 | 58 | 2.1 | 1.1e-07 | 20 |
| Tree::ObjectXS::Hash | 20000 | 50 | 2.4 | 6.7e-08 | 20 |
| Tree::ObjectXS::Array | 21000 | 48 | 2.5 | 6.2e-08 | 23 |
+------------------------------------+-----------+-----------+------------+---------+---------+
Benchmark with bencher -m TreeObject::Build --include-datasets 'medium1 (19531 nodes)'
:
#table2#
+------------------------------------+-----------+-----------+------------+-----------+---------+
| participant | rate (/s) | time (ms) | vs_slowest | errors | samples |
+------------------------------------+-----------+-----------+------------+-----------+---------+
| Tree::Object::InsideOut | 14 | 71 | 1 | 0.00021 | 20 |
| Tree::Object::Hash::ChildrenAsList | 25.4 | 39.4 | 1.79 | 3.5e-05 | 20 |
| Tree::Object::Hash | 25 | 39 | 1.8 | 6e-05 | 21 |
| Tree::Object::Array::Glob | 28 | 35 | 2 | 4e-05 | 20 |
| Tree::Object::Array | 34 | 29 | 2.4 | 3.2e-05 | 20 |
| Tree::ObjectXS::Hash | 39 | 26 | 2.7 | 3.8e-05 | 20 |
| Tree::ObjectXS::Array | 40 | 25 | 2.8 | 3.2e-05 | 21 |
+------------------------------------+-----------+-----------+------------+-----------+---------+
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-Scenarios-TreeObject.
SOURCE
Source repository is at https://github.com/perlancar/perl-Bencher-Scenarios-TreeObject.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenarios-TreeObject
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.