Bencher-Scenarios-Accessors

 view release on metacpan or  search on metacpan

lib/Bencher/Scenario/Accessors/Set.pm  view on Meta::CPAN


 state $o = do { my $o = Perl::Examples::Accessors::Array->new; $o }; $o->[0] = 42



=back

=head1 BENCHMARK SAMPLE RESULTS

=head2 Sample benchmark #1

Run on: perl: I<< v5.34.0 >>, CPU: I<< Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (4 cores) >>, OS: I<< GNU/Linux LinuxMint version 19 >>, OS kernel: I<< Linux version 5.3.0-68-generic >>.

Benchmark command (default options):

 % bencher -m Accessors::Set

Result formatted as table:

 #table1#
 +------------------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
 | participant                        | rate (/s) | time (ns) | pct_faster_vs_slowest | pct_slower_vs_fastest |  errors | samples |
 +------------------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
 | Simple::Accessor                   |    922000 |   1090    |                 0.00% |              2929.69% | 4.1e-10 |      20 |
 | Class::Accessor::PackedString::Set |   1730000 |    579    |                87.44% |              1516.37% | 2.5e-10 |      20 |
 | Class::Accessor::PackedString      |   2380000 |    419    |               158.70% |              1071.14% | 1.5e-10 |      31 |
 | Class::Accessor                    |   2590000 |    386    |               181.28% |               977.11% | 9.8e-11 |      20 |
 | Class::InsideOut                   |   3400000 |    290    |               269.54% |               719.86% | 3.1e-10 |      20 |
 | Object::Pad                        |   4640000 |    216    |               403.39% |               501.86% | 2.9e-11 |      24 |
 | Moose                              |   5120000 |    195    |               455.28% |               445.61% | 5.2e-11 |      20 |
 | Object::Tiny::RW                   |   5270000 |    190    |               472.33% |               429.36% |   7e-11 |      20 |
 | Class::Struct                      |   5390000 |    186    |               484.42% |               418.41% | 1.5e-10 |      20 |
 | Class::Accessor::Array             |   5800000 |    170    |               526.56% |               383.54% | 1.7e-10 |      20 |
 | Mojo::Base                         |   5900000 |    170    |               537.32% |               375.38% | 3.1e-10 |      20 |
 | Mo                                 |   6400000 |    160    |               599.49% |               333.13% | 4.1e-10 |      21 |
 | Object::Simple                     |   6600000 |    150    |               611.69% |               325.70% | 2.4e-10 |      20 |
 | Class::Tiny                        |   6700000 |    150    |               625.50% |               317.60% | 2.1e-10 |      20 |
 | no generator (hash-based)          |   7000000 |    140    |               655.64% |               300.94% | 2.1e-10 |      24 |
 | no generator (array-based)         |   7480000 |    134    |               711.82% |               273.20% | 9.8e-11 |      20 |
 | Mouse                              |  11200000 |     89.28 |              1115.36% |               149.28% | 5.5e-12 |      25 |
 | Moops                              |  11000000 |     88    |              1134.75% |               145.37% | 2.2e-10 |      20 |
 | Moos                               |  12000000 |     81    |              1237.15% |               126.58% | 2.2e-10 |      20 |
 | Object::Tiny::RW::XS               |  13000000 |     77    |              1310.03% |               114.87% | 2.4e-10 |      21 |
 | Mojo::Base::XS                     |  13500000 |     74.3  |              1360.26% |               107.48% |   7e-11 |      20 |
 | Moo                                |  13500000 |     74    |              1366.84% |               106.54% | 5.7e-11 |      20 |
 | Class::XSAccessor                  |  15000000 |     68    |              1497.85% |                89.61% | 1.6e-10 |      20 |
 | Class::XSAccessor::Array           |  17000000 |     58    |              1771.16% |                61.91% | 2.1e-10 |      20 |
 | raw hash access                    |  25000000 |     41    |              2579.11% |                13.09% | 2.4e-10 |      20 |
 | raw array access                   |  28000000 |     36    |              2929.69% |                 0.00% |   2e-10 |      26 |
 +------------------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+


The above result formatted in L<Benchmark.pm|Benchmark> style:

                                            Rate  Simple::Accessor  Class::Accessor::PackedString::Set  Class::Accessor::PackedString  Class::Accessor  Class::InsideOut  Object::Pad  Moose  Object::Tiny::RW  Class::Struct  Class::Accessor::Array  Moj...
  Simple::Accessor                      922000/s                --                                -46%                           -61%             -64%              -73%         -80%   -82%              -82%           -82%                    -84%     ...
  Class::Accessor::PackedString::Set   1730000/s               88%                                  --                           -27%             -33%              -49%         -62%   -66%              -67%           -67%                    -70%     ...
  Class::Accessor::PackedString        2380000/s              160%                                 38%                             --              -7%              -30%         -48%   -53%              -54%           -55%                    -59%     ...
  Class::Accessor                      2590000/s              182%                                 50%                             8%               --              -24%         -44%   -49%              -50%           -51%                    -55%     ...
  Class::InsideOut                     3400000/s              275%                                 99%                            44%              33%                --         -25%   -32%              -34%           -35%                    -41%     ...
  Object::Pad                          4640000/s              404%                                168%                            93%              78%               34%           --    -9%              -12%           -13%                    -21%     ...
  Moose                                5120000/s              458%                                196%                           114%              97%               48%          10%     --               -2%            -4%                    -12%     ...
  Object::Tiny::RW                     5270000/s              473%                                204%                           120%             103%               52%          13%     2%                --            -2%                    -10%     ...
  Class::Struct                        5390000/s              486%                                211%                           125%             107%               55%          16%     4%                2%             --                     -8%     ...
  Class::Accessor::Array               5800000/s              541%                                240%                           146%             127%               70%          27%    14%               11%             9%                      --     ...
  Mojo::Base                           5900000/s              541%                                240%                           146%             127%               70%          27%    14%               11%             9%                      0%     ...
  Mo                                   6400000/s              581%                                261%                           161%             141%               81%          35%    21%               18%            16%                      6%     ...
  Object::Simple                       6600000/s              626%                                286%                           179%             157%               93%          43%    30%               26%            24%                     13%     ...
  Class::Tiny                          6700000/s              626%                                286%                           179%             157%               93%          43%    30%               26%            24%                     13%     ...
  no generator (hash-based)            7000000/s              678%                                313%                           199%             175%              107%          54%    39%               35%            32%                     21%     ...
  no generator (array-based)           7480000/s              713%                                332%                           212%             188%              116%          61%    45%               41%            38%                     26%     ...
  Mouse                               11200000/s             1120%                                548%                           369%             332%              224%         141%   118%              112%           108%                     90%     ...
  Moops                               11000000/s             1138%                                557%                           376%             338%              229%         145%   121%              115%           111%                     93%     ...
  Moos                                12000000/s             1245%                                614%                           417%             376%              258%         166%   140%              134%           129%                    109%     ...
  Object::Tiny::RW::XS                13000000/s             1315%                                651%                           444%             401%              276%         180%   153%              146%           141%                    120%     ...
  Mojo::Base::XS                      13500000/s             1367%                                679%                           463%             419%              290%         190%   162%              155%           150%                    128%     ...
  Moo                                 13500000/s             1372%                                682%                           466%             421%              291%         191%   163%              156%           151%                    129%     ...
  Class::XSAccessor                   15000000/s             1502%                                751%                           516%             467%              326%         217%   186%              179%           173%                    150%     ...
  Class::XSAccessor::Array            17000000/s             1779%                                898%                           622%             565%              400%         272%   236%              227%           220%                    193%     ...
  raw hash access                     25000000/s             2558%                               1312%                           921%             841%              607%         426%   375%              363%           353%                    314%     ...
  raw array access                    28000000/s             2927%                               1508%                          1063%             972%              705%         500%   441%              427%           416%                    372%     ...
 
 Legends:
   Class::Accessor: participant=Class::Accessor
   Class::Accessor::Array: participant=Class::Accessor::Array
   Class::Accessor::PackedString: participant=Class::Accessor::PackedString
   Class::Accessor::PackedString::Set: participant=Class::Accessor::PackedString::Set
   Class::InsideOut: participant=Class::InsideOut
   Class::Struct: participant=Class::Struct
   Class::Tiny: participant=Class::Tiny
   Class::XSAccessor: participant=Class::XSAccessor
   Class::XSAccessor::Array: participant=Class::XSAccessor::Array
   Mo: participant=Mo
   Mojo::Base: participant=Mojo::Base
   Mojo::Base::XS: participant=Mojo::Base::XS
   Moo: participant=Moo
   Moops: participant=Moops
   Moos: participant=Moos
   Moose: participant=Moose
   Mouse: participant=Mouse
   Object::Pad: participant=Object::Pad
   Object::Simple: participant=Object::Simple
   Object::Tiny::RW: participant=Object::Tiny::RW
   Object::Tiny::RW::XS: participant=Object::Tiny::RW::XS
   Simple::Accessor: participant=Simple::Accessor
   no generator (array-based): participant=no generator (array-based)
   no generator (hash-based): participant=no generator (hash-based)
   raw array access: participant=raw array access
   raw hash access: participant=raw hash access

The above result presented as chart:

=begin html

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtAAAAH4CAMAAABUnipoAAAJJmlDQ1BpY2MAAEiJlZVnUJNZF8fv8zzphUASQodQQ5EqJYCUEFoo0quoQOidUEVsiLgCK4qINEWQRQEXXJUia0UUC4uCAhZ0gywCyrpxFVFBWXDfGZ33HT+8/5l7z2/+c+bec8/5cAEgiINlwct7YlK6wNvJjhkYFMwE3yiMn5...

=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-Scenarios-Accessors>.

=head1 SOURCE

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

=head1 BUGS

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

=head1 SEE ALSO

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2017, 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.

=cut



( run in 1.335 second using v1.01-cache-2.11-cpan-788537b7465 )