NAME

Bencher::Scenario::Accessors::GeneratorStartup - Benchmark startup of various accessor generators

VERSION

This document describes version 0.151 of Bencher::Scenario::Accessors::GeneratorStartup (from Perl distribution Bencher-ScenarioBundle-Accessors), released on 2024-05-06.

SYNOPSIS

To run benchmark with default option:

% bencher -m Accessors::GeneratorStartup

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.

Class::Accessor 0.51

Class::Accessor::Array 0.032

Class::Accessor::PackedString 0.001

Class::Accessor::PackedString::Set 0.001

Class::InsideOut 1.14

Class::Struct 0.68

Class::Tiny 1.008

Class::XSAccessor 1.19

Class::XSAccessor::Array 1.19

Mo 0.40

Mojo::Base

Mojo::Base::XS 0.07

Moo 2.005005

Moops 0.038

Moos 0.30

Moose 2.2206

Mouse v2.5.10

Object::Pad 0.806

Object::Simple 3.19

Object::Tiny 1.09

Object::Tiny::RW 1.07

Object::Tiny::RW::XS 0.04

Object::Tiny::XS 1.01

Simple::Accessor 1.13

BENCHMARK PARTICIPANTS

BENCHMARK SAMPLE RESULTS

Sample benchmark #1

Run on: perl: v5.38.2, CPU: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (2 cores), OS: GNU/Linux Ubuntu version 20.04, OS kernel: Linux version 5.4.0-164-generic.

Benchmark command (default options):

% bencher -m Accessors::GeneratorStartup

Result formatted as table:

#table1#
+------------------------------------+-----------+-------------------+-----------------------+-----------------------+-----------+---------+
| participant                        | time (ms) | mod_overhead_time | pct_faster_vs_slowest | pct_slower_vs_fastest |  errors   | samples |
+------------------------------------+-----------+-------------------+-----------------------+-----------------------+-----------+---------+
| Moose                              |    140    |            132    |                 0.00% |              1757.20% |   0.00015 |      20 |
| Mojo::Base                         |    113    |            105    |                20.95% |              1435.54% | 3.5e-05   |      20 |
| Moops                              |     59    |             51    |               131.64% |               701.77% | 3.2e-05   |      20 |
| Mouse                              |     26.6  |             18.6  |               415.00% |               260.62% | 2.5e-05   |      20 |
| Moos                               |     20    |             12    |               595.88% |               166.89% | 2.2e-05   |      20 |
| Object::Pad                        |     19.6  |             11.6  |               596.93% |               166.48% | 1.9e-05   |      20 |
| Moo                                |     18    |             10    |               654.42% |               146.18% | 2.6e-05   |      20 |
| Class::InsideOut                   |     17.7  |              9.7  |               671.85% |               140.62% | 1.7e-05   |      20 |
| Object::Tiny::XS                   |     17    |              9    |               704.23% |               130.93% | 1.1e-05   |      20 |
| Object::Simple                     |     16    |              8    |               732.29% |               123.14% | 7.5e-05   |      25 |
| Class::Struct                      |     14.6  |              6.6  |               835.18% |                98.59% | 1.3e-05   |      21 |
| Class::XSAccessor::Array           |     14.4  |              6.4  |               850.01% |                95.49% | 1.2e-05   |      20 |
| Class::Tiny                        |     14    |              6    |               850.03% |                95.49% | 1.5e-05   |      21 |
| Object::Tiny::RW::XS               |     14.2  |              6.2  |               860.08% |                93.44% | 7.3e-06   |      21 |
| Class::XSAccessor                  |     14    |              6    |               873.11% |                90.85% | 2.5e-05   |      20 |
| Class::Accessor                    |     14    |              6    |               874.92% |                90.50% | 1.5e-05   |      21 |
| Mojo::Base::XS                     |     10.9  |              2.9  |              1155.66% |                47.91% | 8.5e-06   |      20 |
| Simple::Accessor                   |     11    |              3    |              1155.96% |                47.87% | 8.3e-05   |      20 |
| Class::Accessor::PackedString      |      9.35 |              1.35 |              1361.77% |                27.05% | 6.9e-06   |      20 |
| Mo                                 |      9.3  |              1.3  |              1369.24% |                26.41% | 1.2e-05   |      20 |
| perl -e1 (baseline)                |      8    |              0    |              1517.77% |                14.80% |   0.00017 |      21 |
| Object::Tiny::RW                   |      7.73 |             -0.27 |              1669.41% |                 4.96% | 5.9e-06   |      20 |
| Object::Tiny                       |      7.68 |             -0.32 |              1680.29% |                 4.32% | 3.7e-06   |      20 |
| Class::Accessor::PackedString::Set |      7.47 |             -0.53 |              1730.04% |                 1.48% | 6.1e-06   |      21 |
| Class::Accessor::Array             |      7.36 |             -0.64 |              1757.20% |                 0.00% | 6.8e-06   |      20 |
+------------------------------------+-----------+-------------------+-----------------------+-----------------------+-----------+---------+

The above result formatted in Benchmark.pm style:

                                        Rate  Moose  Mojo::Base  Moops  Mouse  Moos  Object::Pad   Moo  Class::InsideOut  Object::Tiny::XS  Object::Simple  Class::Struct  Class::XSAccessor::Array  Object::Tiny::RW::XS  Class::Tiny  Class::XSAccessor  Class::Accessor  Simple::Accessor  Mojo::Base::XS  Class::Accessor::PackedString    Mo  perl -e1 (baseline)  Object::Tiny::RW  Object::Tiny  Class::Accessor::PackedString::Set  Class::Accessor::Array 
 Moose                                 7.1/s     --        -19%   -57%   -81%  -85%         -86%  -87%              -87%              -87%            -88%           -89%                      -89%                  -89%         -90%               -90%             -90%              -92%            -92%                           -93%  -93%                 -94%              -94%          -94%                                -94%                    -94% 
 Mojo::Base                            8.8/s    23%          --   -47%   -76%  -82%         -82%  -84%              -84%              -84%            -85%           -87%                      -87%                  -87%         -87%               -87%             -87%              -90%            -90%                           -91%  -91%                 -92%              -93%          -93%                                -93%                    -93% 
 Moops                                16.9/s   137%         91%     --   -54%  -66%         -66%  -69%              -70%              -71%            -72%           -75%                      -75%                  -75%         -76%               -76%             -76%              -81%            -81%                           -84%  -84%                 -86%              -86%          -86%                                -87%                    -87% 
 Mouse                                37.6/s   426%        324%   121%     --  -24%         -26%  -32%              -33%              -36%            -39%           -45%                      -45%                  -46%         -47%               -47%             -47%              -58%            -59%                           -64%  -65%                 -69%              -70%          -71%                                -71%                    -72% 
 Moos                                 50.0/s   600%        465%   195%    33%    --          -1%   -9%              -11%              -15%            -19%           -27%                      -28%                  -29%         -30%               -30%             -30%              -44%            -45%                           -53%  -53%                 -60%              -61%          -61%                                -62%                    -63% 
 Object::Pad                          51.0/s   614%        476%   201%    35%    2%           --   -8%               -9%              -13%            -18%           -25%                      -26%                  -27%         -28%               -28%             -28%              -43%            -44%                           -52%  -52%                 -59%              -60%          -60%                                -61%                    -62% 
 Moo                                  55.6/s   677%        527%   227%    47%   11%           8%    --               -1%               -5%            -11%           -18%                      -19%                  -21%         -22%               -22%             -22%              -38%            -39%                           -48%  -48%                 -55%              -57%          -57%                                -58%                    -59% 
 Class::InsideOut                     56.5/s   690%        538%   233%    50%   12%          10%    1%                --               -3%             -9%           -17%                      -18%                  -19%         -20%               -20%             -20%              -37%            -38%                           -47%  -47%                 -54%              -56%          -56%                                -57%                    -58% 
 Object::Tiny::XS                     58.8/s   723%        564%   247%    56%   17%          15%    5%                4%                --             -5%           -14%                      -15%                  -16%         -17%               -17%             -17%              -35%            -35%                           -45%  -45%                 -52%              -54%          -54%                                -56%                    -56% 
 Object::Simple                       62.5/s   775%        606%   268%    66%   25%          22%   12%               10%                6%              --            -8%                       -9%                  -11%         -12%               -12%             -12%              -31%            -31%                           -41%  -41%                 -50%              -51%          -52%                                -53%                    -54% 
 Class::Struct                        68.5/s   858%        673%   304%    82%   36%          34%   23%               21%               16%              9%             --                       -1%                   -2%          -4%                -4%              -4%              -24%            -25%                           -35%  -36%                 -45%              -47%          -47%                                -48%                    -49% 
 Class::XSAccessor::Array             69.4/s   872%        684%   309%    84%   38%          36%   25%               22%               18%             11%             1%                        --                   -1%          -2%                -2%              -2%              -23%            -24%                           -35%  -35%                 -44%              -46%          -46%                                -48%                    -48% 
 Object::Tiny::RW::XS                 70.4/s   885%        695%   315%    87%   40%          38%   26%               24%               19%             12%             2%                        1%                    --          -1%                -1%              -1%              -22%            -23%                           -34%  -34%                 -43%              -45%          -45%                                -47%                    -48% 
 Class::Tiny                          71.4/s   900%        707%   321%    90%   42%          40%   28%               26%               21%             14%             4%                        2%                    1%           --                 0%               0%              -21%            -22%                           -33%  -33%                 -42%              -44%          -45%                                -46%                    -47% 
 Class::XSAccessor                    71.4/s   900%        707%   321%    90%   42%          40%   28%               26%               21%             14%             4%                        2%                    1%           0%                 --               0%              -21%            -22%                           -33%  -33%                 -42%              -44%          -45%                                -46%                    -47% 
 Class::Accessor                      71.4/s   900%        707%   321%    90%   42%          40%   28%               26%               21%             14%             4%                        2%                    1%           0%                 0%               --              -21%            -22%                           -33%  -33%                 -42%              -44%          -45%                                -46%                    -47% 
 Simple::Accessor                     90.9/s  1172%        927%   436%   141%   81%          78%   63%               60%               54%             45%            32%                       30%                   29%          27%                27%              27%                --              0%                           -15%  -15%                 -27%              -29%          -30%                                -32%                    -33% 
 Mojo::Base::XS                       91.7/s  1184%        936%   441%   144%   83%          79%   65%               62%               55%             46%            33%                       32%                   30%          28%                28%              28%                0%              --                           -14%  -14%                 -26%              -29%          -29%                                -31%                    -32% 
 Class::Accessor::PackedString       107.0/s  1397%       1108%   531%   184%  113%         109%   92%               89%               81%             71%            56%                       54%                   51%          49%                49%              49%               17%             16%                             --    0%                 -14%              -17%          -17%                                -20%                    -21% 
 Mo                                  107.5/s  1405%       1115%   534%   186%  115%         110%   93%               90%               82%             72%            56%                       54%                   52%          50%                50%              50%               18%             17%                             0%    --                 -13%              -16%          -17%                                -19%                    -20% 
 perl -e1 (baseline)                 125.0/s  1650%       1312%   637%   232%  150%         145%  125%              121%              112%            100%            82%                       80%                   77%          75%                75%              75%               37%             36%                            16%   16%                   --               -3%           -4%                                 -6%                     -7% 
 Object::Tiny::RW                    129.4/s  1711%       1361%   663%   244%  158%         153%  132%              128%              119%            106%            88%                       86%                   83%          81%                81%              81%               42%             41%                            20%   20%                   3%                --            0%                                 -3%                     -4% 
 Object::Tiny                        130.2/s  1722%       1371%   668%   246%  160%         155%  134%              130%              121%            108%            90%                       87%                   84%          82%                82%              82%               43%             41%                            21%   21%                   4%                0%            --                                 -2%                     -4% 
 Class::Accessor::PackedString::Set  133.9/s  1774%       1412%   689%   256%  167%         162%  140%              136%              127%            114%            95%                       92%                   90%          87%                87%              87%               47%             45%                            25%   24%                   7%                3%            2%                                  --                     -1% 
 Class::Accessor::Array              135.9/s  1802%       1435%   701%   261%  171%         166%  144%              140%              130%            117%            98%                       95%                   92%          90%                90%              90%               49%             48%                            27%   26%                   8%                5%            4%                                  1%                      -- 

Legends:
  Class::Accessor: mod_overhead_time=6 participant=Class::Accessor
  Class::Accessor::Array: mod_overhead_time=-0.64 participant=Class::Accessor::Array
  Class::Accessor::PackedString: mod_overhead_time=1.35 participant=Class::Accessor::PackedString
  Class::Accessor::PackedString::Set: mod_overhead_time=-0.53 participant=Class::Accessor::PackedString::Set
  Class::InsideOut: mod_overhead_time=9.7 participant=Class::InsideOut
  Class::Struct: mod_overhead_time=6.6 participant=Class::Struct
  Class::Tiny: mod_overhead_time=6 participant=Class::Tiny
  Class::XSAccessor: mod_overhead_time=6 participant=Class::XSAccessor
  Class::XSAccessor::Array: mod_overhead_time=6.4 participant=Class::XSAccessor::Array
  Mo: mod_overhead_time=1.3 participant=Mo
  Mojo::Base: mod_overhead_time=105 participant=Mojo::Base
  Mojo::Base::XS: mod_overhead_time=2.9 participant=Mojo::Base::XS
  Moo: mod_overhead_time=10 participant=Moo
  Moops: mod_overhead_time=51 participant=Moops
  Moos: mod_overhead_time=12 participant=Moos
  Moose: mod_overhead_time=132 participant=Moose
  Mouse: mod_overhead_time=18.6 participant=Mouse
  Object::Pad: mod_overhead_time=11.6 participant=Object::Pad
  Object::Simple: mod_overhead_time=8 participant=Object::Simple
  Object::Tiny: mod_overhead_time=-0.32 participant=Object::Tiny
  Object::Tiny::RW: mod_overhead_time=-0.27 participant=Object::Tiny::RW
  Object::Tiny::RW::XS: mod_overhead_time=6.2 participant=Object::Tiny::RW::XS
  Object::Tiny::XS: mod_overhead_time=9 participant=Object::Tiny::XS
  Simple::Accessor: mod_overhead_time=3 participant=Simple::Accessor
  perl -e1 (baseline): mod_overhead_time=0 participant=perl -e1 (baseline)

The above result presented as chart:

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-ScenarioBundle-Accessors.

SOURCE

Source repository is at https://github.com/perlancar/perl-Bencher-Scenarios-Accessors.

SEE ALSO

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2024, 2017, 2016 by perlancar <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.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-ScenarioBundle-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.