#!perl

our $DATE = '2015-06-16'; # DATE
our $VERSION = '0.02'; # VERSION

use 5.010001;
use strict;
use warnings;

use Benchmark::Command;

Benchmark::Command::run(
    undef,
    {
        'none'                => [$^X, "-e1"],
        'G:Std'               => [$^X, "-e", "use Getopt::Std"],  #core
        'G:Long'              => [$^X, "-e", "use Getopt::Long"], #core

        'G:Long::Less'        => [$^X, "-e", "use Getopt::Long::Less"],
        'G:Long::Complete'    => [$^X, "-e", "use Getopt::Long::Complete"],
        'G:Long::Descriptive' => [$^X, "-e", "use Getopt::Long::Descriptive"],
        'G:Long::Subcommand'  => [$^X, "-e", "use Getopt::Long::Subcommand"],
        'G:ArgvFile'          => [$^X, "-e", "use Getopt::ArgvFile"],
        'G:Lucid'             => [$^X, "-e", "use Getopt::Lucid"],
        'G:Std::Strict'       => [$^X, "-e", "use Getopt::Std::Strict"],
        'MooseX::Getopt'      => [$^X, "-e", "use MooseX::Getopt"],
    },
);

# ABSTRACT: Benchmark startup time of some popular Perl Getopt modules
# PODNAME: bench-startup-getopt-modules

__END__

=pod

=encoding UTF-8

=head1 NAME

bench-startup-getopt-modules - Benchmark startup time of some popular Perl Getopt modules

=head1 VERSION

This document describes version 0.02 of bench-startup-getopt-modules (from Perl distribution App-BenchStartupGetoptModules), released on 2015-06-16.

=head1 SYNOPSIS

 % bench-startup-getopt-modules

Sample output:

                                 Rate MooseX::Getopt G:Long::Descriptive       G:Lucid    G:ArgvFile       G:Long G:Long::Subcommand G:Std::Strict G:Long::Complete G:Long::Less      G:Std   none
 MooseX::Getopt      4.8056+-0.0061/s             --              -85.7%        -89.3%        -91.7%       -93.7%             -95.3%        -96.8%           -97.8%       -98.1%     -98.5% -99.0%
 G:Long::Descriptive  33.494+-0.031/s      597+-1.1%                  --        -25.3%        -42.0%       -56.4%             -67.1%        -78.0%           -84.8%       -86.4%     -89.7% -93.0%
 G:Lucid              44.837+-0.057/s      833+-1.7%        33.87+-0.21%            --        -22.4%       -41.7%             -56.0%        -70.5%           -79.6%       -81.9%     -86.3% -90.7%
 G:ArgvFile             57.77+-0.19/s   1102.2+-4.3%        72.49+-0.59%  28.85+-0.46%            --       -24.9%             -43.3%        -62.0%           -73.7%       -76.6%     -82.3% -88.0%
 G:Long                 76.89+-0.11/s       1500+-3%       129.56+-0.38%  71.48+-0.32%  33.08+-0.48%           --             -24.5%        -49.4%           -65.1%       -68.9%     -76.4% -84.0%
 G:Long::Subcommand     101.9+-0.32/s   2020.4+-7.1%       204.23+-0.99% 127.26+-0.77%   76.37+-0.8% 32.53+-0.45%                 --        -32.9%           -53.7%       -58.8%     -68.8% -78.8%
 G:Std::Strict         151.92+-0.18/s   3061.3+-5.5%       353.57+-0.69%  238.83+-0.6% 162.96+-0.93% 97.59+-0.37%        49.09+-0.5%            --           -31.0%       -38.5%     -53.5% -68.4%
 G:Long::Complete      220.04+-0.94/s      4479+-20%           557+-2.9%   390.8+-2.2%   280.9+-2.1%  186.2+-1.3%        115.9+-1.1%  44.84+-0.64%               --       -11.0%     -32.6% -54.3%
 G:Long::Less              247.2+-1/s      5043+-22%         637.9+-3.1%   451.2+-2.4%   327.8+-2.3%  221.5+-1.4%        142.6+-1.3%   62.69+-0.7%     12.32+-0.67%           --     -24.3% -48.7%
 G:Std                   326.4+-1.2/s      6692+-27%         874.5+-3.8%   627.9+-2.9%   464.9+-2.8%  324.5+-1.7%        220.3+-1.6% 114.84+-0.86%     48.33+-0.85% 32.06+-0.74%         -- -32.2%
 none                       481+-17/s     9920+-350%           1337+-50%      974+-38%      733+-29%     526+-22%           373+-17%      217+-11%      118.8+-7.7%   94.8+-6.9% 47.5+-5.2%     --
 
 Average times:
   none               :     2.0790ms
   G:Std              :     3.0637ms
   G:Long::Less       :     4.0453ms
   G:Long::Complete   :     4.5446ms
   G:Std::Strict      :     6.5824ms
   G:Long::Subcommand :     9.8135ms
   G:Long             :    13.0056ms
   G:ArgvFile         :    17.3100ms
   G:Lucid            :    22.3030ms
   G:Long::Descriptive:    29.8561ms
   MooseX::Getopt     :   208.0906ms

=head1 SEE ALSO

=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C bench-startup-getopt-modules bench-startup-getopt-modules

in your bash startup (e.g. C<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install L<shcompgen> which allows you to
activate completion scripts for several kinds of scripts on multiple shells.
Some CPAN distributions (those that are built with
L<Dist::Zilla::Plugin::GenShellCompletion>) will even automatically enable shell
completion for their included scripts (using C<shcompgen>) at installation time,
so you can immadiately have tab completion.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete bench-startup-getopt-modules 'p/*/`bench-startup-getopt-modules`/'

in your tcsh startup (e.g. C<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install C<shcompgen> (see above).

=head2 other shells

For fish and zsh, install C<shcompgen> as described above.

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C bench-startup-getopt-modules bench-startup-getopt-modules

in your bash startup (e.g. C<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install L<shcompgen> which allows you to
activate completion scripts for several kinds of scripts on multiple shells.
Some CPAN distributions (those that are built with
L<Dist::Zilla::Plugin::GenShellCompletion>) will even automatically enable shell
completion for their included scripts (using C<shcompgen>) at installation time,
so you can immadiately have tab completion.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete bench-startup-getopt-modules 'p/*/`bench-startup-getopt-modules`/'

in your tcsh startup (e.g. C<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install C<shcompgen> (see above).

=head2 other shells

For fish and zsh, install C<shcompgen> as described above.

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/App-BenchStartupGetoptModules>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-App-BenchStartupGetoptModules>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-BenchStartupGetoptModules>

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 AUTHOR

perlancar <perlancar@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2015 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
