in reply to Re: Date comparisons + Benchmark
in thread Date comparisons
Yes, the numbers say that your calculations with Date::Calc run 1300 times faster than your calculations with Date::Manip. You weren't "comparing apples to apples" (the Date::Calc loop doesn't do any "parsing" at all), however, so that speed difference is going to be, at least a bit, overstated.
But much more important than that, is that the numbers say that reparsing two dates and then comparing them can be done in 1/100th of a second with Date::Manip (on your computer with those simple date formats). Because even being 1300-times faster doesn't mean that you'll even notice the difference. (:
So, for example, if we wanted to compute a date difference for each news article as we display it, well, 1/100th of a second vs. 1e-5 seconds isn't going to make a noticeable difference at all. If we want to compute a date difference for thousands of news articles in order to select a dozen articles to list, then this will probably make a quite noticeable difference.
But your benchmarks don't apply at all well to the original problem. If the news articles came with month, day, and year already parse out as numbers, then I probably would just use Time::Local since it just exposes an ANSI-standard-C function.
Given the task of parsing dates in news articles, I'd start with Date::Manip, since that is exactly the kind of problem it was designed for (since Usenet news articles usually have dates encoded in different formats and from different timezones and Date::Manip knows how to take that into account) and using it would require very little coding on my part. If the results seemed slow to me, then I'd look at how much work it would take to use something else and then decide whether it was worth my time to produce enough working code that I could compare the subjective speed difference for my specific task.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Date comparisons + Benchmark
by baku (Scribe) on Feb 09, 2001 at 20:04 UTC |