On Mon, Aug 11, 2003 at 10:25:07PM +0200, awards wrote:
> Hi,
> 
> thank you, Now i have a new question.
> If I do the code myself which I can do.
> would the process of executing the program faster if I do the code myself or
> if I use a Module i.e Date::Calc??
> 
> regards
> awards


There is a small amount of overhead in loading a module, but it's
generally negligible.  After that, the question of "will my
hand-rolled code be faster than the module" comes down to a comparison
between the particular way that you implemented the code versus the
particular way that the module implemented it.  That is something that
only benchmarking can answer for you.

However, I would **strongly** recommend using the module.  It will
save you a lot of time, because the module is already written and
thoroughly tested, it is standard so it will make the lives of future
maintenance programmers (which might include you) easier, and, most
importantly, date math is a lot harder than you might think.  Here
are just a couple examples of why:

Q: If you add 24 hours to 12:10pm, February 28, what do you get?  
A: You can't tell without knowing what year you are working in (leap
year problem). 

Q: If you are working with past dates, how do you handle the fact that
different parts of the world adopted the Julian calendar on different
dates?


--Dks

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to