#!perl

our $DATE = '2015-06-19'; # DATE
our $VERSION = '0.01'; # VERSION

use 5.010001;
use strict;
use warnings;

use Benchmark::Command;

die "Usage: $0 <module> ...\n" unless @ARGV;
my @mods;
for (@ARGV) {
    die "Invalid module name '$_'\n" unless /\A\w+(::\w+)*\z/;
    push @mods, $_;
}

Benchmark::Command::run(
    undef,
    {
        'none'       => [$^X, "-e1"],
        map {($_ => [$^X, "-e", "use $_"])} @mods,
    },
);

# ABSTRACT: Benchmark startup time of Perl modules
# PODNAME: bench-startup-modules

__END__

=pod

=encoding UTF-8

=head1 NAME

bench-startup-modules - Benchmark startup time of Perl modules

=head1 VERSION

This document describes version 0.01 of bench-startup-modules (from Perl distribution App-BenchStartupModules), released on 2015-06-19.

=head1 SYNOPSIS

 % bench-startup-modules Getopt::Long Getopt::Long::Less Getopt::Long::EvenLess

Sample output:

                                  Rate Getopt::Long Getopt::Long::Less Getopt::Long::EvenLess   none
 Getopt::Long              76.5+-0.2/s           --             -68.4%                 -80.2% -87.3%
 Getopt::Long::Less         242.2+-3/s    216.6+-4%                 --                 -37.3% -59.9%
 Getopt::Long::EvenLess 386.13+-0.76/s  404.7+-1.7%           59.4+-2%                     -- -36.0%
 none                       603.3+-4/s  688.6+-5.6%        149.1+-3.5%             56.2+-1.1%     --
 
 Average times:
   none                  :     1.6576ms
   Getopt::Long::EvenLess:     2.5898ms
   Getopt::Long::Less    :     4.1288ms
   Getopt::Long          :    13.0719ms

=head1 HOMEPAGE

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

=head1 SOURCE

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

=head1 BUGS

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

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
