NAME

Bencher::Scenario::Accessors::Construction - Benchmark object construction

VERSION

This document describes version 0.11 of Bencher::Scenario::Accessors::Construction (from Perl distribution Bencher-Scenarios-Accessors), released on 2016-09-29.

SYNOPSIS

To run benchmark with default option:

% bencher -m Accessors::Construction

To run module startup overhead benchmark:

% bencher --module-startup -m Accessors::Construction

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.

Class::Accessor 0.34

Class::Accessor::Array 0.02

Class::InsideOut 1.13

Class::Tiny 1.004

Class::XSAccessor 1.19

Class::XSAccessor::Array 1.19

Mo 0.40

Mojo::Base

Mojo::Base::XS 0.07

Moo 2.002004

Moose 2.1805

Mouse v2.4.5

Object::Simple 3.1703

Perl::Examples::Accessors 0.08

Perl::Examples::Accessors::Array 0.08

Perl::Examples::Accessors::ClassAccessor 0.08

Perl::Examples::Accessors::ClassAccessorArray 0.08

Perl::Examples::Accessors::ClassInsideOut 0.08

Perl::Examples::Accessors::ClassTiny 0.08

Perl::Examples::Accessors::ClassXSAccessor 0.08

Perl::Examples::Accessors::ClassXSAccessorArray 0.08

Perl::Examples::Accessors::Hash 0.08

Perl::Examples::Accessors::Mo 0.08

Perl::Examples::Accessors::MojoBase 0.08

Perl::Examples::Accessors::MojoBaseXS 0.08

Perl::Examples::Accessors::Moo 0.08

Perl::Examples::Accessors::Moose 0.08

Perl::Examples::Accessors::Mouse 0.08

Perl::Examples::Accessors::ObjectSimple 0.08

Perl::Examples::Accessors::Scalar 0.08

Perl::Examples::Accessors::SimpleAccessor 0.08

Simple::Accessor 1.02

BENCHMARK PARTICIPANTS

  • Class::Tiny (perl_code)

    Code template:

    Perl::Examples::Accessors::ClassTiny->new
  • Object::Simple (perl_code)

    Code template:

    Perl::Examples::Accessors::ObjectSimple->new
  • Class::Accessor (perl_code)

    Code template:

    Perl::Examples::Accessors::ClassAccessor->new
  • Mouse (perl_code)

    Code template:

    Perl::Examples::Accessors::Mouse->new
  • Mojo::Base::XS (perl_code)

    Code template:

    Perl::Examples::Accessors::MojoBaseXS->new
  • Moose (perl_code)

    Code template:

    Perl::Examples::Accessors::Moose->new
  • Class::Accessor::Array (perl_code)

    Code template:

    Perl::Examples::Accessors::ClassAccessorArray->new
  • no generator (array-based) (perl_code)

    Code template:

    Perl::Examples::Accessors::Array->new
  • no generator (scalar-based) (perl_code)

    Code template:

    Perl::Examples::Accessors::Scalar->new
  • Class::InsideOut (perl_code)

    Code template:

    Perl::Examples::Accessors::ClassInsideOut->new
  • Moo (perl_code)

    Code template:

    Perl::Examples::Accessors::Moo->new
  • Mo (perl_code)

    Code template:

    Perl::Examples::Accessors::Mo->new
  • Class::XSAccessor::Array (perl_code)

    Code template:

    Perl::Examples::Accessors::ClassXSAccessorArray->new
  • Mojo::Base (perl_code)

    Code template:

    Perl::Examples::Accessors::MojoBase->new
  • Simple::Accessor (perl_code)

    Code template:

    Perl::Examples::Accessors::SimpleAccessor->new
  • no generator (hash-based) (perl_code)

    Code template:

    Perl::Examples::Accessors::Hash->new
  • Class::XSAccessor (perl_code)

    Code template:

    Perl::Examples::Accessors::ClassXSAccessor->new

SAMPLE BENCHMARK RESULTS

Run on: perl: v5.24.0, 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::Construction):

#table1#
+-----------------------------+-----------+-----------+------------+---------+---------+
| participant                 | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+-----------------------------+-----------+-----------+------------+---------+---------+
| Class::InsideOut            |    188000 |    5.32   |      1     | 1.6e-09 |      22 |
| Simple::Accessor            |    330000 |    3.1    |      1.7   | 6.1e-09 |      24 |
| Class::Tiny                 |    370000 |    2.7    |      2     | 3.3e-09 |      20 |
| Moose                       |    520000 |    1.9    |      2.8   | 3.3e-09 |      20 |
| Mo                          |    770000 |    1.3    |      4.1   | 2.1e-09 |      20 |
| Moo                         |   1019000 |    0.9818 |      5.416 | 1.1e-11 |      20 |
| Class::Accessor             |   1100000 |    0.92   |      5.8   | 1.7e-09 |      20 |
| Mouse                       |   1400000 |    0.7    |      7.6   |   1e-09 |      20 |
| no generator (array-based)  |   1700000 |    0.58   |      9.1   | 8.3e-10 |      20 |
| Object::Simple              |   2100000 |    0.48   |     11     | 8.3e-10 |      20 |
| no generator (hash-based)   |   2152000 |    0.4646 |     11.45  | 1.1e-11 |      20 |
| Mojo::Base                  |   2200000 |    0.455  |     11.7   | 2.1e-10 |      20 |
| Class::Accessor::Array      |   2360000 |    0.4238 |     12.55  | 1.1e-11 |      20 |
| no generator (scalar-based) |   2400000 |    0.416  |     12.8   | 2.1e-10 |      20 |
| Class::XSAccessor           |   3200000 |    0.31   |     17     | 4.5e-10 |      20 |
| Mojo::Base::XS              |   3200000 |    0.31   |     17     | 3.9e-10 |      23 |
| Class::XSAccessor::Array    |   3500000 |    0.29   |     18     | 8.7e-10 |      20 |
+-----------------------------+-----------+-----------+------------+---------+---------+

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.