MathGroup Archive 2008

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

Search the Archive

Built-in DatePlus and DateDifference are much slower than DaysPlus

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.


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

Out[49]= {1.08407, Null}


   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,


  • 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