NAME
Bencher::Scenario::Accessors::Set - Benchmark attribute write/set
VERSION
This document describes version 0.07 of Bencher::Scenario::Accessors::Set (from Perl distribution Bencher-Scenarios-Accessors), released on 2016-06-23.
SYNOPSIS
To run benchmark with default option:
% bencher -m Accessors::Set
To run module startup overhead benchmark:
% bencher --module-startup -m Accessors::Set
For more options (dump scenario, list/include/exclude/add participants, list/include/exclude/add datasets, etc), see bencher or run bencher --help
.
BENCHMARKED MODULES
Version numbers shown below are the versions used when running the sample benchmark.
Perl::Examples::Accessors::Array 0.05
Perl::Examples::Accessors::ClassAccessor 0.05
Perl::Examples::Accessors::ClassAccessorArray 0.05
Perl::Examples::Accessors::ClassInsideOut 0.05
Perl::Examples::Accessors::ClassXSAccessor 0.05
Perl::Examples::Accessors::ClassXSAccessorArray 0.05
Perl::Examples::Accessors::Hash 0.05
Perl::Examples::Accessors::Mo 0.05
Perl::Examples::Accessors::MojoBase 0.05
Perl::Examples::Accessors::Moo 0.05
Perl::Examples::Accessors::Moose 0.05
Perl::Examples::Accessors::Mouse 0.05
Perl::Examples::Accessors::ObjectSimple 0.05
BENCHMARK PARTICIPANTS
Moose (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Moose->new; $o }; $o->attr1(42)
Mo (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Mo->new; $o }; $o->attr1(42)
Mojo::Base (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::MojoBase->new; $o }; $o->attr1(42)
Class::Accessor::Array (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::ClassAccessorArray->new; $o }; $o->attr1(42)
Object::Simple (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::ObjectSimple->new; $o }; $o->attr1(42)
no generator (hash-based) (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Hash->new; $o }; $o->attr1(42)
Moo (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Moo->new; $o }; $o->attr1(42)
Class::InsideOut (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::ClassInsideOut->new; $o }; $o->attr1(42)
Class::Accessor (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::ClassAccessor->new; $o }; $o->attr1(42)
Class::XSAccessor::Array (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::ClassXSAccessorArray->new; $o }; $o->attr1(42)
Mouse (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Mouse->new; $o }; $o->attr1(42)
no generator (array-based) (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Array->new; $o }; $o->attr1(42)
Class::XSAccessor (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::ClassXSAccessor->new; $o }; $o->attr1(42)
raw hash access (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Hash->new; $o }; $o->{attr1} = 42
raw array access (perl_code)
Code template:
state $o = do { my $o = Perl::Examples::Accessors::Array->new; $o }; $o->[0] = 42
SAMPLE BENCHMARK RESULTS
Run on: perl: v5.22.1, CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz (4 cores), OS: GNU/Linux Debian version 8.0, OS kernel: Linux version 3.16.0-4-amd64.
Benchmark with default options (bencher -m Accessors::Set
):
+----------------------------+-----------+-----------+------------+---------+---------+
| participant | rate (/s) | time (ns) | vs_slowest | errors | samples |
+----------------------------+-----------+-----------+------------+---------+---------+
| Class::Accessor | 1100000 | 950 | 1 | 1.7e-09 | 20 |
| Class::InsideOut | 1770000 | 564 | 1.68 | 2.9e-10 | 20 |
| no generator (hash-based) | 2800000 | 360 | 2.6 | 1e-09 | 20 |
| Mojo::Base | 3010000 | 332 | 2.86 | 2.8e-10 | 20 |
| no generator (array-based) | 3020000 | 332 | 2.86 | 1e-10 | 20 |
| Object::Simple | 3190000 | 313 | 3.03 | 1.9e-10 | 31 |
| Moose | 3210000 | 311 | 3.05 | 2.1e-10 | 20 |
| Mo | 3360000 | 298 | 3.19 | 9e-11 | 20 |
| Class::Accessor::Array | 3410000 | 294 | 3.23 | 1.5e-10 | 20 |
| Mouse | 5460000 | 183 | 5.19 | 1.5e-10 | 24 |
| Moo | 8000000 | 130 | 7.6 | 1.4e-10 | 26 |
| Class::XSAccessor | 8400000 | 120 | 7.9 | 1.5e-10 | 20 |
| Class::XSAccessor::Array | 10000000 | 100 | 9.5 | 2.1e-10 | 20 |
| raw hash access | 17000000 | 60 | 16 | 3.5e-10 | 20 |
| raw array access | 20000000 | 50 | 20 | 7e-10 | 33 |
+----------------------------+-----------+-----------+------------+---------+---------+
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.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Bencher-Scenarios-Accessors.
SOURCE
Source repository is at https://github.com/perlancar/perl-Bencher-Scenarios-Accessors.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenarios-Accessors
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.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 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.