#!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 POSIX qw(strftime);

my @lt = localtime();

cmpthese(
    0,
    {
        'strftime("") 1k'                   => sub { strftime("",                   @lt) for 1..1000 },
        'strftime("%Y-%m-%d") 1k'           => sub { strftime("%Y-%m-%d",           @lt) for 1..1000 },
        'strftime("%F") 1k'                 => sub { strftime("%F",                 @lt) for 1..1000 },
        'strftime("%Y-%m-%dT%H:%M:%SZ") 1k' => sub { strftime("%Y-%m-%dT%H:%M:%SZ", @lt) for 1..1000 },
        'strftime("%FT%TZ) 1k'              => sub { strftime("%FT%TZ",             @lt) for 1..1000 },
    },
);

# ABSTRACT: Benchmark date formatting
# PODNAME: bench-strftime

__END__

=pod

=encoding UTF-8

=head1 NAME

bench-strftime - Benchmark date formatting

=head1 VERSION

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

=head1 SYNOPSIS

 % bench-strftime

Sample output:

                                             Rate strftime("%FT%TZ) 1k strftime("%Y-%m-%dT%H:%M:%SZ") 1k strftime("%F") 1k strftime("%Y-%m-%d") 1k strftime("") 1k
 strftime("%FT%TZ) 1k              357.18+-0.47/s                   --                             -7.5%             -8.1%                  -12.1%          -18.0%
 strftime("%Y-%m-%dT%H:%M:%SZ") 1k  386.2+-0.58/s          8.12+-0.22%                                --             -0.7%                   -4.9%          -11.3%
 strftime("%F") 1k                 388.86+-0.32/s          8.87+-0.17%                       0.69+-0.17%                --                   -4.3%          -10.7%
 strftime("%Y-%m-%d") 1k           406.17+-0.73/s         13.72+-0.25%                       5.17+-0.25%       4.45+-0.21%                      --           -6.7%
 strftime("") 1k                   435.56+-0.42/s          21.94+-0.2%                       12.78+-0.2%      12.01+-0.14%             7.23+-0.22%              --

=head1 DESCRIPTION

Conclusion: basically the format strings used are not the bottleneck.

=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
