MathGroup Archive 2007

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

Search the Archive

Re: why DateListPlot is so slow?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79927] Re: [mg79889] why DateListPlot is so slow?
  • From: Stern <nycstern at gmail.com>
  • Date: Thu, 9 Aug 2007 05:13:43 -0400 (EDT)
  • References: <200708080847.EAA05756@smc.vnet.net>

Ah, I have been planning to raise this issue. The problem, as you may
have guessed, is in that the date format conversion tools,
AbsoluteTime and DateString, are extremely slow. Before the
introduction of DateListPlot and DateString, I had created my own
versions of both functions in Mathematica 5.x, which ran about 100x
faster than the built-in version in Mathematica 6.

The problem, I think, lies in the way that Mathematica does pattern
matching to figure out the original date format so that it can convert
it into standard integer format. For example, given "10/1/2005", it
works out on its own that this must be MM/DD/YYYY format. It seems to
repeat this extraction for every date or time in the dataset,
reporting exceptions whenever it hits an ambiguous date like
"1/2/2007".

What made my original code so much faster, and what I wish Wolfram
would introduce themselves, was the ability to specify the date format
by hand. For example, DateListPlot[{whatever}, DateFormat->"HH:MM:SS"]
or AbsoluteTime[whatever,DateFormat->"MM/DD/YY"].

When passed the DateFormat parameter, the software would then be able
to skip all of its own efforts to figure this out.

In the meantime, all I can suggest is that you try converting your
times to Integer format using AbsoluteTime and pass it to DateListPlot
in that format. It won't be any quicker the first time through but at
least you have to do it only once, and if you are generating a number
of graphs with the same data, it should save some time.

Would anybody from Wolfram care to comment?

-stern



On 8/8/07, Arkadiusz.Majka at gmail.com <Arkadiusz.Majka at gmail.com> wrote:
> Hi,
>
> I have a list (a time series):
>
> data={{00:00:30,x1},{00:01:00,x2},{00:01:30,x3},....}
>
> at equally spaced time intervals (30 seconds). The length od data is
> 8100 (24 h)
>
> DateListPlot[data] works fine but takes 28 sec, since
> ListPlot[data[[All,2]]] does it in less than 0.1 sec....
>
> Can you explain me why DateListPlot is so time consuming? Can we
> improve it?
>
> Best,
>
> Arek
>
>
>


  • Prev by Date: Re: why DateListPlot is so slow?
  • Next by Date: Re: FindRoot can NOT handle mixed real and complex variables
  • Previous by thread: Re: why DateListPlot is so slow?
  • Next by thread: Re: why DateListPlot is so slow?