Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Built-in DatePlus and DateDifference are much slower than DaysPlus

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87829] Built-in DatePlus and DateDifference are much slower than DaysPlus
  • From: Luci Ellis <luci at verbeia.com>
  • Date: Fri, 18 Apr 2008 02:39:39 -0400 (EDT)


Dear MathGroup,

I am not sure if this is a question or comment. I thought I should note the

following timing differences between the built-in DateDifference and

DatePlus functions, and the corresponding functions from the Calendar

package, DaysBetween and DaysPlus. Timings are from an original iMac G5.



Do[

   DaysBetween[{2000, 3, 3}, {2002, 2, 2}];, {1000}]; // Timing





Out[49]= {1.08407, Null}







Do[

   DateDifference[{2000, 3, 3}, {2002, 2, 2}];, {1000}]; // Timing





Out[50]= {5.39334, Null}



In[56]:= Table[DaysPlus[{2000, 1, 1}, i], {i, 1000}]; // Timing





Out[56]= {1.88357, Null}



In[57]:= Table[DatePlus[{2000, 1, 1}, i], {i, 1000}]; // Timing





Out[57]= {2.75215, Null}









I got a 100% speed-up by switching to the functions from the package. This

is a puzzle, because the commands from the Calendar package would seem more

general. If anyone has any insights on why this might be, that would be

interesting. Otherwise I'm just putting the information out there, in case

it is helpful to someone.



Best regards,

Luci






  • Prev by Date: Re: Numerical integration and list of points
  • Next by Date: Re: If Integrate returns no result, can we conclude that no
  • Previous by thread: Re: Indefinite numbers of arguments in a function
  • Next by thread: Comments on the .m file editor