in reply to Date comparisons
Though Date::Manip is a really powerful tool, as his author states in the documentation, it's nearly always an overkill to use it in simple tasks.
You should probably want to benchmark Date::Manip with other modules like Date::Calc with the Delta_days() function, which might be what you're looking for.
Update:I just benchmarked both module and Manip is really slower than Calc (but remember that Calc is not 100% Perl, and Date::Manip parses each time the dates we provide)
Here's the code and the results of the Benchmark, if anyone wants to optimize, criticize, or bencmark with other module:
$d1 = '14', $m1 = '08', $y1 = '2001'; $d2 = '16', $m2 = '12', $y2 = '2001'; $dt1 = "2001/08/14"; $dt2 = "2001/12/16"; timethese(-10, { # running for at least 10 seconds 'Calc' => \&Calc, 'Manip' => \&Manip, }); sub Calc { my $Dd = Date::Calc::Delta_Days($y1,$m1,$d1,$y2,$m2,$d2); } sub Manip { my $date1=Date::Manip::ParseDate($dt1); my $date2=Date::Manip::ParseDate($dt2); my $flag=Date::Manip::Date_Cmp($date1,$date2); }
The results:
Benchmark: running Calc, Manip, each for at least 10 CPU seconds... Calc: 12 wallclock secs (11.04 usr + 0.00 sys = 11.04 CPU) @ 142935.85/s (n=1577440) Manip:10 wallclock secs (10.56 usr + 0.00 sys = 10.56 CPU) @ 104.88/s (n=1107)
Is this making Date::Calc 1300 times faster than Date::Manip?
-- Briac
<kbd>--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Date comparisons + Benchmark
by tye (Sage) on Feb 09, 2001 at 19:27 UTC | |
by baku (Scribe) on Feb 09, 2001 at 20:04 UTC |