Acme-CPANModules-CalculatingDayOfWeek

 view release on metacpan or  search on metacpan

lib/Acme/CPANModules/CalculatingDayOfWeek.pm  view on Meta::CPAN

=head1 BENCHMARKED MODULES

Version numbers shown below are the versions used when running the sample benchmark.

L<Date::DayOfWeek> 1.22

L<Time::DayOfWeek> 1.8

L<DateTime> 1.59

L<Date::Calc> 6.4

L<Time::Moment> 0.44

=head1 BENCHMARK PARTICIPANTS

=over

=item * Date::DayOfWeek::dayofweek (perl_code)

Function call template:

 Date::DayOfWeek::dayofweek(<day>, <month>, <year>)



=item * Time::DayOfWeek::DoW (perl_code)

Function call template:

 Time::DayOfWeek::DoW(<year>, <month>, <day>)



=item * DateTime (perl_code)

Code template:

 DateTime->new(year=><year>, month=><month>, day=><day>)->day_of_week



=item * Date::Calc::Day_of_Week (perl_code)

Function call template:

 Date::Calc::Day_of_Week(<year>, <month>, <day>)



=item * Time::Moment (perl_code)

Code template:

 Time::Moment->new(year => <year>, month => <month>, day => <day>)->day_of_week



=back

=head1 BENCHMARK DATASETS

=over

=item * date1

=back

=head1 BENCHMARK SAMPLE RESULTS

=head2 Sample benchmark #1

Run on: perl: I<< v5.38.0 >>, CPU: I<< Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (2 cores) >>, OS: I<< GNU/Linux Ubuntu version 20.04 >>, OS kernel: I<< Linux version 5.4.0-91-generic >>.

Benchmark command (default options):

 % bencher --cpanmodules-module CalculatingDayOfWeek

Result formatted as table:

 #table1#
 {dataset=>"date1"}
 +----------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
 | participant                | rate (/s) | time (μs) | pct_faster_vs_slowest | pct_slower_vs_fastest |  errors | samples |
 +----------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+
 | DateTime                   |     37000 |    27     |                 0.00% |              8030.29% | 3.8e-08 |      24 |
 | Date::DayOfWeek::dayofweek |    562000 |     1.78  |              1415.39% |               436.51% | 3.8e-10 |      20 |
 | Date::Calc::Day_of_Week    |    650000 |     1.54  |              1650.85% |               364.36% | 9.3e-10 |      20 |
 | Time::DayOfWeek::DoW       |   1030000 |     0.97  |              2677.36% |               192.73% | 6.3e-10 |      20 |
 | Time::Moment               |   3020000 |     0.331 |              8030.29% |                 0.00% | 1.7e-10 |      20 |
 +----------------------------+-----------+-----------+-----------------------+-----------------------+---------+---------+

The above result formatted in L<Benchmark.pm|Benchmark> style:

                 Rate      D  DD:d  DC:D_o_W  TD:D   T:M 
  D           37000/s     --  -93%      -94%  -96%  -98% 
  DD:d       562000/s  1416%    --      -13%  -45%  -81% 
  DC:D_o_W   650000/s  1653%   15%        --  -37%  -78% 
  TD:D      1030000/s  2683%   83%       58%    --  -65% 
  T:M       3020000/s  8057%  437%      365%  193%    -- 
 
 Legends:
   D: participant=DateTime
   DC:D_o_W: participant=Date::Calc::Day_of_Week
   DD:d: participant=Date::DayOfWeek::dayofweek
   T:M: participant=Time::Moment
   TD:D: participant=Time::DayOfWeek::DoW


=head2 Sample benchmark #2

Benchmark command (benchmarking module startup overhead):

 % bencher --cpanmodules-module CalculatingDayOfWeek --module-startup

Result formatted as table:

 #table2#
 +---------------------+-----------+-------------------+-----------------------+-----------------------+---------+---------+
 | participant         | time (ms) | mod_overhead_time | pct_faster_vs_slowest | pct_slower_vs_fastest |  errors | samples |
 +---------------------+-----------+-------------------+-----------------------+-----------------------+---------+---------+



( run in 0.677 second using v1.01-cache-2.11-cpan-140bd7fdf52 )