#!perl

our $DATE = '2015-08-17'; # DATE
our $VERSION = '0.01'; # VERSION

use 5.010001;
use strict;
use warnings;

use Benchmark::Dumb qw(cmpthese);
use Time::HiRes ();

cmpthese(
    0,
    {
        'time() 1k'             => sub { no warnings 'void'; time() for 1..1000 },
        'time() (HiRes) 1k'     => sub { Time::HiRes::time() for 1..1000 },
        'list localtime() 1k'   => sub { my @lt = localtime() for 1..1000 },
        'scalar localtime() 1k' => sub { my $lt = localtime() for 1..1000 },
    },
);

# ABSTRACT: Benchmark timestamp generation
# PODNAME: bench-timestamp-generation

__END__

=pod

=encoding UTF-8

=head1 NAME

bench-timestamp-generation - Benchmark timestamp generation

=head1 VERSION

This document describes version 0.01 of bench-timestamp-generation (from Perl distribution App-BenchDates), released on 2015-08-17.

=head1 SYNOPSIS

 % bench-timestamp-generation

Sample output:

                                 Rate scalar localtime() 1k list localtime() 1k time() (HiRes) 1k time() 1k
 scalar localtime() 1k 495.18+-0.81/s                    --               -8.8%            -94.9%    -98.2%
 list localtime() 1k   543.12+-0.52/s           9.68+-0.21%                  --            -94.4%    -98.1%
 time() (HiRes) 1k         9670+-20/s          1852.9+-5.1%        1680.5+-4.1%                --    -65.3%
 time() 1k              27902+-0.07/s          5534.8+-9.2%             5037.4%      188.54+-0.6%        --

=head1 DESCRIPTION

=head1 SEE ALSO

=head1 HOMEPAGE

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

=head1 SOURCE

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

=head1 BUGS

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

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
