package Bencher::Scenario::Accessors::GeneratorStartup;

use strict;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2024-05-06'; # DATE
our $DIST = 'Bencher-ScenarioBundle-Accessors'; # DIST
our $VERSION = '0.151'; # VERSION

use Bencher::ScenarioUtil::Accessors;

my $classes = \%Bencher::ScenarioUtil::Accessors::classes;

our $scenario = {
    summary => 'Benchmark startup of various accessor generators',
    module_startup => 1,
    modules => {
    },
    participants => [
        map {
            my $spec = $classes->{$_};
            +{ (module=>$spec->{generator}) x !!$spec->{generator} };
        } keys %$classes,
    ],
};

1;
# ABSTRACT: Benchmark startup of various accessor generators

__END__

=pod

=encoding UTF-8

=head1 NAME

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

=head1 VERSION

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

=head1 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 L<bencher> or run C<bencher --help>.

=head1 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 L<Bencher> and L<bencher> (CLI) for more details.

=head1 BENCHMARKED MODULES

Version numbers shown below are the versions used when running the sample benchmark.

L<Class::Accessor> 0.51

L<Class::Accessor::Array> 0.032

L<Class::Accessor::PackedString> 0.001

L<Class::Accessor::PackedString::Set> 0.001

L<Class::InsideOut> 1.14

L<Class::Struct> 0.68

L<Class::Tiny> 1.008

L<Class::XSAccessor> 1.19

L<Class::XSAccessor::Array> 1.19

L<Mo> 0.40

L<Mojo::Base>

L<Mojo::Base::XS> 0.07

L<Moo> 2.005005

L<Moops> 0.038

L<Moos> 0.30

L<Moose> 2.2206

L<Mouse> v2.5.10

L<Object::Pad> 0.806

L<Object::Simple> 3.19

L<Object::Tiny> 1.09

L<Object::Tiny::RW> 1.07

L<Object::Tiny::RW::XS> 0.04

L<Object::Tiny::XS> 1.01

L<Simple::Accessor> 1.13

=head1 BENCHMARK PARTICIPANTS

=over

=item * Class::Tiny (perl_code)

L<Class::Tiny>



=item * Class::Accessor::Array (perl_code)

L<Class::Accessor::Array>



=item *  (perl_code)



=item * Mojo::Base (perl_code)

L<Mojo::Base>



=item * Object::Tiny::RW::XS (perl_code)

L<Object::Tiny::RW::XS>



=item * Class::XSAccessor (perl_code)

L<Class::XSAccessor>



=item * Moops (perl_code)

L<Moops>



=item * Class::InsideOut (perl_code)

L<Class::InsideOut>



=item * Moos (perl_code)

L<Moos>



=item *  (perl_code)



=item * Class::Accessor::PackedString (perl_code)

L<Class::Accessor::PackedString>



=item * Object::Tiny::RW (perl_code)

L<Object::Tiny::RW>



=item * Simple::Accessor (perl_code)

L<Simple::Accessor>



=item * Object::Tiny::XS (perl_code)

L<Object::Tiny::XS>



=item * Object::Simple (perl_code)

L<Object::Simple>



=item * Mouse (perl_code)

L<Mouse>



=item * Mojo::Base::XS (perl_code)

L<Mojo::Base::XS>



=item * Class::Struct (perl_code)

L<Class::Struct>



=item *  (perl_code)



=item * Class::Accessor (perl_code)

L<Class::Accessor>



=item * Moo (perl_code)

L<Moo>



=item * Class::Accessor::PackedString::Set (perl_code)

L<Class::Accessor::PackedString::Set>



=item * Class::XSAccessor::Array (perl_code)

L<Class::XSAccessor::Array>



=item * Moose (perl_code)

L<Moose>



=item * Mo (perl_code)

L<Mo>



=item * Object::Tiny (perl_code)

L<Object::Tiny>



=item * Object::Pad (perl_code)

L<Object::Pad>



=back

=head1 BENCHMARK SAMPLE RESULTS

=head2 Sample benchmark #1

Run on: perl: I<< v5.38.2 >>, CPU: I<< Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (2 cores) >>, OS: I<< GNU/Linux Ubuntu version 20.04 >>, OS kernel: I<< 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 L<Benchmark.pm|Benchmark> 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:

=begin html

<img src="data:image/png;base64, " />

=end html


To display as an interactive HTML table on a browser, you can add option C<--format html+datatables>.

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/Bencher-ScenarioBundle-Accessors>.

=head1 SOURCE

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

=head1 SEE ALSO

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 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 L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
L<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.

=head1 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.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<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.

=cut
