NAME
Bencher::Scenario::Accessors::Construction - Benchmark object construction
VERSION
This document describes version 0.150 of Bencher::Scenario::Accessors::Construction (from Perl distribution Bencher-Scenarios-Accessors), released on 2021-08-03.
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.66
Class::Tiny 1.008
Class::XSAccessor 1.19
Mo 0.40
Mojo::Base::XS 0.07
Moo 2.004004
Moops 0.038
Moos 0.30
Moose 2.2015
Mouse v2.5.10
Object::Pad 0.46
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::Accessor::PackedString (perl_code)
Code template:
Perl::Examples::Accessors::ClassAccessorPackedString->new
Class::Accessor::Array (perl_code)
Code template:
Perl::Examples::Accessors::ClassAccessorArray->new
Mojo::Base (perl_code)
Code template:
Perl::Examples::Accessors::MojoBase->new
Object::Tiny (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTiny->new
Simple::Accessor (perl_code)
Code template:
Perl::Examples::Accessors::SimpleAccessor->new
Object::Tiny::RW (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTinyRW->new
Moose (perl_code)
Code template:
Perl::Examples::Accessors::Moose->new
no generator (scalar-based) (perl_code)
Code template:
Perl::Examples::Accessors::Scalar->new
Moos (perl_code)
Code template:
Perl::Examples::Accessors::Moos->new
Object::Pad (perl_code)
Code template:
Perl::Examples::Accessors::ObjectPad->new
Object::Tiny::XS (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTinyXS->new
Mouse (perl_code)
Code template:
Perl::Examples::Accessors::Mouse->new
Mo (perl_code)
Code template:
Perl::Examples::Accessors::Mo->new
Object::Simple (perl_code)
Code template:
Perl::Examples::Accessors::ObjectSimple->new
Moops (perl_code)
Code template:
Perl::Examples::Accessors::Moops->new
Class::Struct (perl_code)
Code template:
Perl::Examples::Accessors::ClassStruct->new
Class::XSAccessor (perl_code)
Code template:
Perl::Examples::Accessors::ClassXSAccessor->new
Object::Tiny::RW::XS (perl_code)
Code template:
Perl::Examples::Accessors::ObjectTinyRWXS->new
no generator (array-based) (perl_code)
Code template:
Perl::Examples::Accessors::Array->new
Moo (perl_code)
Code template:
Perl::Examples::Accessors::Moo->new
Class::InsideOut (perl_code)
Code template:
Perl::Examples::Accessors::ClassInsideOut->new
Mojo::Base::XS (perl_code)
Code template:
Perl::Examples::Accessors::MojoBaseXS->new
Class::Accessor (perl_code)
Code template:
Perl::Examples::Accessors::ClassAccessor->new
Class::Tiny (perl_code)
Code template:
Perl::Examples::Accessors::ClassTiny->new
no generator (hash-based) (perl_code)
Code template:
Perl::Examples::Accessors::Hash->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
BENCHMARK SAMPLE RESULTS
Sample benchmark #1
Run on: perl: v5.34.0, CPU: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (4 cores), OS: GNU/Linux LinuxMint version 19, OS kernel: Linux version 5.3.0-68-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 | 180000 | 5.5 | 0.00% | 3937.69% | 6.7e-09 | 20 |
| Class::InsideOut | 444000 | 2.25 | 143.26% | 1559.84% | 8.3e-10 | 20 |
| Class::Tiny | 800000 | 1.2 | 340.11% | 817.44% | 1.7e-09 | 20 |
| Simple::Accessor | 1011600 | 0.98854 | 454.56% | 628.10% | 4.9e-12 | 22 |
| Moose | 1000000 | 0.98 | 461.58% | 618.98% | 3.3e-09 | 20 |
| Class::Accessor::PackedString | 1578600 | 0.63348 | 765.37% | 366.58% | 5.7e-12 | 20 |
| Class::Struct | 1600000 | 0.62 | 780.64% | 358.49% | 1.6e-09 | 23 |
| Mo | 1650400 | 0.60593 | 804.72% | 346.29% | 5.7e-12 | 20 |
| Object::Pad | 1660000 | 0.604 | 807.75% | 344.80% | 2e-10 | 22 |
| Moops | 1700000 | 0.6 | 815.63% | 340.97% | 8.3e-10 | 20 |
| Moo | 1700000 | 0.58 | 846.42% | 326.63% | 8.3e-10 | 20 |
| Mouse | 2100000 | 0.47 | 1068.25% | 245.62% | 8.3e-10 | 20 |
| Class::Accessor::Array | 2810000 | 0.3559 | 1440.23% | 162.15% | 2.3e-11 | 20 |
| no generator (array-based) | 3250000 | 0.308 | 1681.16% | 126.69% | 1e-10 | 20 |
| Mojo::Base | 3800000 | 0.26 | 1982.75% | 93.86% | 3.1e-10 | 20 |
| Object::Simple | 3868000 | 0.2586 | 2020.26% | 90.43% | 4.9e-12 | 20 |
| no generator (hash-based) | 3989000 | 0.2507 | 2087.02% | 84.62% | 5.1e-12 | 20 |
| Object::Tiny::RW | 4086000 | 0.2447 | 2140.11% | 80.25% | 4.8e-12 | 20 |
| Object::Tiny | 4090000 | 0.244 | 2142.72% | 80.04% | 8.8e-11 | 28 |
| Class::Accessor::PackedString::Set | 4119000 | 0.2428 | 2158.22% | 78.80% | 5e-12 | 20 |
| no generator (scalar-based) | 4200000 | 0.24 | 2197.16% | 75.77% | 3.3e-10 | 31 |
| Class::Accessor | 4792000 | 0.2087 | 2526.83% | 53.71% | 4.9e-12 | 20 |
| Object::Tiny::RW::XS | 6700000 | 0.15 | 3552.59% | 10.54% | 2.1e-10 | 20 |
| Object::Tiny::XS | 6800000 | 0.15 | 3625.85% | 8.37% | 2.1e-10 | 20 |
| Mojo::Base::XS | 6800000 | 0.15 | 3627.76% | 8.31% | 2.6e-10 | 20 |
| Class::XSAccessor | 6840000 | 0.146 | 3649.75% | 7.68% | 4.6e-11 | 26 |
| Class::XSAccessor::Array | 7400000 | 0.14 | 3937.69% | 0.00% | 1.6e-10 | 20 |
+------------------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
The above result formatted in Benchmark.pm style:
Rate Moos Class::InsideOut Class::Tiny Simple::Accessor Moose Class::Accessor::PackedString Class::Struct Mo Object::Pad Moops Moo Mouse Class::Accessor::Array no generator (array-based) Mojo::Base Object::Simple no generator (hash-based) Object::Tiny::RW Object::Tiny Class::Accessor::PackedString::Set no generator (scalar-based) Class::Accessor Object::Tiny::RW::XS Object::Tiny::XS Mojo::Base::XS Class::XSAccessor Class::XSAccessor::Array
Moos 180000/s -- -59% -78% -82% -82% -88% -88% -88% -89% -89% -89% -91% -93% -94% -95% -95% -95% -95% -95% -95% -95% -96% -97% -97% -97% -97% -97%
Class::InsideOut 444000/s 144% -- -46% -56% -56% -71% -72% -73% -73% -73% -74% -79% -84% -86% -88% -88% -88% -89% -89% -89% -89% -90% -93% -93% -93% -93% -93%
Class::Tiny 800000/s 358% 87% -- -17% -18% -47% -48% -49% -49% -50% -51% -60% -70% -74% -78% -78% -79% -79% -79% -79% -80% -82% -87% -87% -87% -87% -88%
Simple::Accessor 1011600/s 456% 127% 21% -- 0% -35% -37% -38% -38% -39% -41% -52% -63% -68% -73% -73% -74% -75% -75% -75% -75% -78% -84% -84% -84% -85% -85%
Moose 1000000/s 461% 129% 22% 0% -- -35% -36% -38% -38% -38% -40% -52% -63% -68% -73% -73% -74% -75% -75% -75% -75% -78% -84% -84% -84% -85% -85%
Class::Accessor::PackedString 1578600/s 768% 255% 89% 56% 54% -- -2% -4% -4% -5% -8% -25% -43% -51% -58% -59% -60% -61% -61% -61% -62% -67% -76% -76% -76% -76% -77%
Class::Struct 1600000/s 787% 262% 93% 59% 58% 2% -- -2% -2% -3% -6% -24% -42% -50% -58% -58% -59% -60% -60% -60% -61% -66% -75% -75% -75% -76% -77%
Mo 1650400/s 807% 271% 98% 63% 61% 4% 2% -- 0% 0% -4% -22% -41% -49% -57% -57% -58% -59% -59% -59% -60% -65% -75% -75% -75% -75% -76%
Object::Pad 1660000/s 810% 272% 98% 63% 62% 4% 2% 0% -- 0% -3% -22% -41% -49% -56% -57% -58% -59% -59% -59% -60% -65% -75% -75% -75% -75% -76%
Moops 1700000/s 816% 275% 100% 64% 63% 5% 3% 0% 0% -- -3% -21% -40% -48% -56% -56% -58% -59% -59% -59% -60% -65% -75% -75% -75% -75% -76%
Moo 1700000/s 848% 287% 106% 70% 68% 9% 6% 4% 4% 3% -- -18% -38% -46% -55% -55% -56% -57% -57% -58% -58% -64% -74% -74% -74% -74% -75%
Mouse 2100000/s 1070% 378% 155% 110% 108% 34% 31% 28% 28% 27% 23% -- -24% -34% -44% -44% -46% -47% -48% -48% -48% -55% -68% -68% -68% -68% -70%
Class::Accessor::Array 2810000/s 1445% 532% 237% 177% 175% 77% 74% 70% 69% 68% 62% 32% -- -13% -26% -27% -29% -31% -31% -31% -32% -41% -57% -57% -57% -58% -60%
no generator (array-based) 3250000/s 1685% 630% 289% 220% 218% 105% 101% 96% 96% 94% 88% 52% 15% -- -15% -16% -18% -20% -20% -21% -22% -32% -51% -51% -51% -52% -54%
Mojo::Base 3800000/s 2015% 765% 361% 280% 276% 143% 138% 133% 132% 130% 123% 80% 36% 18% -- 0% -3% -5% -6% -6% -7% -19% -42% -42% -42% -43% -46%
Object::Simple 3868000/s 2026% 770% 364% 282% 278% 144% 139% 134% 133% 132% 124% 81% 37% 19% 0% -- -3% -5% -5% -6% -7% -19% -41% -41% -41% -43% -45%
no generator (hash-based) 3989000/s 2093% 797% 378% 294% 290% 152% 147% 141% 140% 139% 131% 87% 41% 22% 3% 3% -- -2% -2% -3% -4% -16% -40% -40% -40% -41% -44%
Object::Tiny::RW 4086000/s 2147% 819% 390% 303% 300% 158% 153% 147% 146% 145% 137% 92% 45% 25% 6% 5% 2% -- 0% 0% -1% -14% -38% -38% -38% -40% -42%
Object::Tiny 4090000/s 2154% 822% 391% 305% 301% 159% 154% 148% 147% 145% 137% 92% 45% 26% 6% 5% 2% 0% -- 0% -1% -14% -38% -38% -38% -40% -42%
Class::Accessor::PackedString::Set 4119000/s 2165% 826% 394% 307% 303% 160% 155% 149% 148% 147% 138% 93% 46% 26% 7% 6% 3% 0% 0% -- -1% -14% -38% -38% -38% -39% -42%
no generator (scalar-based) 4200000/s 2191% 837% 400% 311% 308% 163% 158% 152% 151% 150% 141% 95% 48% 28% 8% 7% 4% 1% 1% 1% -- -13% -37% -37% -37% -39% -41%
Class::Accessor 4792000/s 2535% 978% 474% 373% 369% 203% 197% 190% 189% 187% 177% 125% 70% 47% 24% 23% 20% 17% 16% 16% 14% -- -28% -28% -28% -30% -32%
Object::Tiny::RW::XS 6700000/s 3566% 1400% 700% 559% 553% 322% 313% 303% 302% 300% 286% 213% 137% 105% 73% 72% 67% 63% 62% 61% 60% 39% -- 0% 0% -2% -6%
Object::Tiny::XS 6800000/s 3566% 1400% 700% 559% 553% 322% 313% 303% 302% 300% 286% 213% 137% 105% 73% 72% 67% 63% 62% 61% 60% 39% 0% -- 0% -2% -6%
Mojo::Base::XS 6800000/s 3566% 1400% 700% 559% 553% 322% 313% 303% 302% 300% 286% 213% 137% 105% 73% 72% 67% 63% 62% 61% 60% 39% 0% 0% -- -2% -6%
Class::XSAccessor 6840000/s 3667% 1441% 721% 577% 571% 333% 324% 315% 313% 310% 297% 221% 143% 110% 78% 77% 71% 67% 67% 66% 64% 42% 2% 2% 2% -- -4%
Class::XSAccessor::Array 7400000/s 3828% 1507% 757% 606% 599% 352% 342% 332% 331% 328% 314% 235% 154% 119% 85% 84% 79% 74% 74% 73% 71% 49% 7% 7% 7% 4% --
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-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) 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.