NAME
Bencher::Scenario::Accessors::Construction - Benchmark object construction
VERSION
This document describes version 0.151 of Bencher::Scenario::Accessors::Construction (from Perl distribution Bencher-ScenarioBundle-Accessors), released on 2024-05-06.
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
.
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
Mo 0.40
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
Perl::Examples::Accessors 0.132
Perl::Examples::Accessors::Array 0.132
Perl::Examples::Accessors::ClassAccessor 0.132
Perl::Examples::Accessors::ClassAccessorArray 0.132
Perl::Examples::Accessors::ClassAccessorPackedString 0.132
Perl::Examples::Accessors::ClassAccessorPackedStringSet 0.132
Perl::Examples::Accessors::ClassInsideOut 0.132
Perl::Examples::Accessors::ClassStruct 0.132
Perl::Examples::Accessors::ClassTiny 0.132
Perl::Examples::Accessors::ClassXSAccessor 0.132
Perl::Examples::Accessors::ClassXSAccessorArray 0.132
Perl::Examples::Accessors::Hash 0.132
Perl::Examples::Accessors::Mo 0.132
Perl::Examples::Accessors::MojoBase 0.132
Perl::Examples::Accessors::MojoBaseXS 0.132
Perl::Examples::Accessors::Moo 0.132
Perl::Examples::Accessors::Moops 0.132
Perl::Examples::Accessors::Moos 0.132
Perl::Examples::Accessors::Moose 0.132
Perl::Examples::Accessors::Mouse 0.132
Perl::Examples::Accessors::ObjectPad 0.132
Perl::Examples::Accessors::ObjectSimple 0.132
Perl::Examples::Accessors::ObjectTiny 0.132
Perl::Examples::Accessors::ObjectTinyRW 0.132
Perl::Examples::Accessors::ObjectTinyRWXS 0.132
Perl::Examples::Accessors::ObjectTinyXS 0.132
Perl::Examples::Accessors::Scalar 0.132
Perl::Examples::Accessors::SimpleAccessor 0.132
Simple::Accessor 1.13
BENCHMARK PARTICIPANTS
Class::Tiny (perl_code)
Code template:
Perl::Examples::Accessors::ClassTiny->new
Class::Accessor::Array (perl_code)
Code template:
Perl::Examples::Accessors::ClassAccessorArray->new
no generator (scalar-based) (perl_code)
Code template:
Perl::Examples::Accessors::Scalar->new
Mojo::Base (perl_code)
Code template:
Perl::Examples::Accessors::MojoBase->new
Object::Tiny::RW::XS (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTinyRWXS->new
Class::XSAccessor (perl_code)
Code template:
Perl::Examples::Accessors::ClassXSAccessor->new
Moops (perl_code)
Code template:
Perl::Examples::Accessors::Moops->new
Class::InsideOut (perl_code)
Code template:
Perl::Examples::Accessors::ClassInsideOut->new
Moos (perl_code)
Code template:
Perl::Examples::Accessors::Moos->new
no generator (hash-based) (perl_code)
Code template:
Perl::Examples::Accessors::Hash->new
Class::Accessor::PackedString (perl_code)
Code template:
Perl::Examples::Accessors::ClassAccessorPackedString->new
Object::Tiny::RW (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTinyRW->new
Simple::Accessor (perl_code)
Code template:
Perl::Examples::Accessors::SimpleAccessor->new
Object::Tiny::XS (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTinyXS->new
Object::Simple (perl_code)
Code template:
Perl::Examples::Accessors::ObjectSimple->new
Mouse (perl_code)
Code template:
Perl::Examples::Accessors::Mouse->new
Mojo::Base::XS (perl_code)
Code template:
Perl::Examples::Accessors::MojoBaseXS->new
Class::Struct (perl_code)
Code template:
Perl::Examples::Accessors::ClassStruct->new
no generator (array-based) (perl_code)
Code template:
Perl::Examples::Accessors::Array->new
Class::Accessor (perl_code)
Code template:
Perl::Examples::Accessors::ClassAccessor->new
Moo (perl_code)
Code template:
Perl::Examples::Accessors::Moo->new
Class::Accessor::PackedString::Set (perl_code)
Code template:
Perl::Examples::Accessors::ClassAccessorPackedStringSet->new
Class::XSAccessor::Array (perl_code)
Code template:
Perl::Examples::Accessors::ClassXSAccessorArray->new
Moose (perl_code)
Code template:
Perl::Examples::Accessors::Moose->new
Mo (perl_code)
Code template:
Perl::Examples::Accessors::Mo->new
Object::Tiny (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTiny->new
Object::Pad (perl_code)
Code template:
Perl::Examples::Accessors::ObjectPad->new
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::Construction
Result formatted as table:
#table1#
+------------------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
| participant | rate (/s) | time (μs) | pct_faster_vs_slowest | pct_slower_vs_fastest | errors | samples |
+------------------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
| Moos | 144000 | 6.94 | 0.00% | 4396.84% | 2.9e-09 | 20 |
| Class::InsideOut | 370000 | 2.7 | 156.94% | 1650.13% | 3e-09 | 20 |
| Class::Tiny | 699000 | 1.43 | 385.20% | 826.80% | 5.8e-10 | 20 |
| Simple::Accessor | 818000 | 1.22 | 467.67% | 692.15% | 6.5e-10 | 20 |
| Moose | 842000 | 1.19 | 483.98% | 670.03% | 9.5e-10 | 20 |
| Class::Accessor::PackedString | 1290000 | 0.776 | 794.00% | 403.00% | 2.4e-10 | 21 |
| Mo | 1440000 | 0.696 | 897.14% | 350.97% | 1.2e-10 | 20 |
| Class::Struct | 1460000 | 0.683 | 916.14% | 342.54% | 1.7e-10 | 20 |
| Moo | 1540000 | 0.65 | 967.53% | 321.24% | 6.7e-11 | 20 |
| Moops | 1540000 | 0.648 | 971.26% | 319.77% | 1.6e-10 | 20 |
| Mouse | 2000000 | 0.5 | 1286.77% | 224.27% | 6.3e-10 | 20 |
| Object::Pad | 2040000 | 0.49 | 1314.94% | 217.81% | 9.1e-11 | 21 |
| Class::Accessor::Array | 2400000 | 0.416 | 1568.34% | 169.54% | 8.1e-11 | 23 |
| no generator (array-based) | 2820000 | 0.355 | 1854.28% | 130.10% | 6.4e-11 | 20 |
| Class::Accessor::PackedString::Set | 3280000 | 0.304 | 2179.37% | 97.28% | 8.6e-11 | 22 |
| no generator (scalar-based) | 3360000 | 0.298 | 2228.26% | 93.14% | 1.2e-10 | 25 |
| Mojo::Base | 3360000 | 0.298 | 2231.33% | 92.89% | 1e-10 | 21 |
| Object::Simple | 3380000 | 0.296 | 2241.97% | 92.01% | 4.2e-11 | 20 |
| Object::Tiny::RW | 3410000 | 0.293 | 2268.71% | 89.84% | 3.1e-11 | 20 |
| Object::Tiny | 3423000 | 0.2922 | 2274.98% | 89.34% | 2.3e-11 | 20 |
| no generator (hash-based) | 3450000 | 0.29 | 2294.83% | 87.77% | 6.6e-11 | 20 |
| Class::Accessor | 4240000 | 0.236 | 2841.29% | 52.89% | 6.3e-11 | 22 |
| Object::Tiny::RW::XS | 5800000 | 0.17 | 3916.96% | 11.95% | 2e-10 | 20 |
| Object::Tiny::XS | 5970000 | 0.167 | 4043.81% | 8.52% | 2.6e-11 | 20 |
| Class::XSAccessor | 6000000 | 0.167 | 4062.56% | 8.03% | 5.7e-11 | 21 |
| Mojo::Base::XS | 6010000 | 0.166 | 4069.72% | 7.85% | 4.2e-11 | 23 |
| Class::XSAccessor::Array | 6500000 | 0.15 | 4396.84% | 0.00% | 2e-10 | 20 |
+------------------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
The above result formatted in Benchmark.pm style:
Rate Moos Class::InsideOut Class::Tiny Simple::Accessor Moose Class::Accessor::PackedString Mo Class::Struct Moo Moops Mouse Object::Pad Class::Accessor::Array no generator (array-based) Class::Accessor::PackedString::Set no generator (scalar-based) Mojo::Base Object::Simple Object::Tiny::RW Object::Tiny no generator (hash-based) Class::Accessor Object::Tiny::RW::XS Object::Tiny::XS Class::XSAccessor Mojo::Base::XS Class::XSAccessor::Array
Moos 144000/s -- -61% -79% -82% -82% -88% -89% -90% -90% -90% -92% -92% -94% -94% -95% -95% -95% -95% -95% -95% -95% -96% -97% -97% -97% -97% -97%
Class::InsideOut 370000/s 157% -- -47% -54% -55% -71% -74% -74% -75% -76% -81% -81% -84% -86% -88% -88% -88% -89% -89% -89% -89% -91% -93% -93% -93% -93% -94%
Class::Tiny 699000/s 385% 88% -- -14% -16% -45% -51% -52% -54% -54% -65% -65% -70% -75% -78% -79% -79% -79% -79% -79% -79% -83% -88% -88% -88% -88% -89%
Simple::Accessor 818000/s 468% 121% 17% -- -2% -36% -42% -44% -46% -46% -59% -59% -65% -70% -75% -75% -75% -75% -75% -76% -76% -80% -86% -86% -86% -86% -87%
Moose 842000/s 483% 126% 20% 2% -- -34% -41% -42% -45% -45% -57% -58% -65% -70% -74% -74% -74% -75% -75% -75% -75% -80% -85% -85% -85% -86% -87%
Class::Accessor::PackedString 1290000/s 794% 247% 84% 57% 53% -- -10% -11% -16% -16% -35% -36% -46% -54% -60% -61% -61% -61% -62% -62% -62% -69% -78% -78% -78% -78% -80%
Mo 1440000/s 897% 287% 105% 75% 70% 11% -- -1% -6% -6% -28% -29% -40% -48% -56% -57% -57% -57% -57% -58% -58% -66% -75% -76% -76% -76% -78%
Class::Struct 1460000/s 916% 295% 109% 78% 74% 13% 1% -- -4% -5% -26% -28% -39% -48% -55% -56% -56% -56% -57% -57% -57% -65% -75% -75% -75% -75% -78%
Moo 1540000/s 967% 315% 119% 87% 83% 19% 7% 5% -- 0% -23% -24% -36% -45% -53% -54% -54% -54% -54% -55% -55% -63% -73% -74% -74% -74% -76%
Moops 1540000/s 970% 316% 120% 88% 83% 19% 7% 5% 0% -- -22% -24% -35% -45% -53% -54% -54% -54% -54% -54% -55% -63% -73% -74% -74% -74% -76%
Mouse 2000000/s 1288% 440% 186% 144% 138% 55% 39% 36% 30% 29% -- -2% -16% -29% -39% -40% -40% -40% -41% -41% -42% -52% -65% -66% -66% -66% -70%
Object::Pad 2040000/s 1316% 451% 191% 148% 142% 58% 42% 39% 32% 32% 2% -- -15% -27% -37% -39% -39% -39% -40% -40% -40% -51% -65% -65% -65% -66% -69%
Class::Accessor::Array 2400000/s 1568% 549% 243% 193% 186% 86% 67% 64% 56% 55% 20% 17% -- -14% -26% -28% -28% -28% -29% -29% -30% -43% -59% -59% -59% -60% -63%
no generator (array-based) 2820000/s 1854% 660% 302% 243% 235% 118% 96% 92% 83% 82% 40% 38% 17% -- -14% -16% -16% -16% -17% -17% -18% -33% -52% -52% -52% -53% -57%
Class::Accessor::PackedString::Set 3280000/s 2182% 788% 370% 301% 291% 155% 128% 124% 113% 113% 64% 61% 36% 16% -- -1% -1% -2% -3% -3% -4% -22% -44% -45% -45% -45% -50%
no generator (scalar-based) 3360000/s 2228% 806% 379% 309% 299% 160% 133% 129% 118% 117% 67% 64% 39% 19% 2% -- 0% 0% -1% -1% -2% -20% -42% -43% -43% -44% -49%
Mojo::Base 3360000/s 2228% 806% 379% 309% 299% 160% 133% 129% 118% 117% 67% 64% 39% 19% 2% 0% -- 0% -1% -1% -2% -20% -42% -43% -43% -44% -49%
Object::Simple 3380000/s 2244% 812% 383% 312% 302% 162% 135% 130% 119% 118% 68% 65% 40% 19% 2% 0% 0% -- -1% -1% -2% -20% -42% -43% -43% -43% -49%
Object::Tiny::RW 3410000/s 2268% 821% 388% 316% 306% 164% 137% 133% 121% 121% 70% 67% 41% 21% 3% 1% 1% 1% -- 0% -1% -19% -41% -43% -43% -43% -48%
Object::Tiny 3423000/s 2275% 824% 389% 317% 307% 165% 138% 133% 122% 121% 71% 67% 42% 21% 4% 1% 1% 1% 0% -- 0% -19% -41% -42% -42% -43% -48%
no generator (hash-based) 3450000/s 2293% 831% 393% 320% 310% 167% 140% 135% 124% 123% 72% 68% 43% 22% 4% 2% 2% 2% 1% 0% -- -18% -41% -42% -42% -42% -48%
Class::Accessor 4240000/s 2840% 1044% 505% 416% 404% 228% 194% 189% 175% 174% 111% 107% 76% 50% 28% 26% 26% 25% 24% 23% 22% -- -27% -29% -29% -29% -36%
Object::Tiny::RW::XS 5800000/s 3982% 1488% 741% 617% 599% 356% 309% 301% 282% 281% 194% 188% 144% 108% 78% 75% 75% 74% 72% 71% 70% 38% -- -1% -1% -2% -11%
Object::Tiny::XS 5970000/s 4055% 1516% 756% 630% 612% 364% 316% 308% 289% 288% 199% 193% 149% 112% 82% 78% 78% 77% 75% 74% 73% 41% 1% -- 0% 0% -10%
Class::XSAccessor 6000000/s 4055% 1516% 756% 630% 612% 364% 316% 308% 289% 288% 199% 193% 149% 112% 82% 78% 78% 77% 75% 74% 73% 41% 1% 0% -- 0% -10%
Mojo::Base::XS 6010000/s 4080% 1526% 761% 634% 616% 367% 319% 311% 291% 290% 201% 195% 150% 113% 83% 79% 79% 78% 76% 76% 74% 42% 2% 0% 0% -- -9%
Class::XSAccessor::Array 6500000/s 4526% 1700% 853% 713% 693% 417% 363% 355% 333% 332% 233% 226% 177% 136% 102% 98% 98% 97% 95% 94% 93% 57% 13% 11% 11% 10% --
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: participant=Object::Tiny
Object::Tiny::RW: participant=Object::Tiny::RW
Object::Tiny::RW::XS: participant=Object::Tiny::RW::XS
Object::Tiny::XS: participant=Object::Tiny::XS
Simple::Accessor: participant=Simple::Accessor
no generator (array-based): participant=no generator (array-based)
no generator (hash-based): participant=no generator (hash-based)
no generator (scalar-based): participant=no generator (scalar-based)
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.