Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5830

Re: runs slowly?

From Michael Stern <nycstern@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: runs slowly?
Date 2011-10-24 09:13 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j83a7d$k07$1@smc.vnet.net> (permalink)
References <201110231025.GAA10587@smc.vnet.net>

Show all headers | View raw


All the date functions in Mathematica are extremely slow. In benchmarks I sent to Wolfram a few months ago (and some of which can be seen at
http://www.wheels.org/monkeywrench/?p=453), the date functions in Mathematica ran about 1/82 the speed of the same functions in Visual Basic for Applications. If you know the format of the dates you are converting, you may be able to roll your own date functions much faster than Wolfram's. I have encouraged them to improve this code, but they will probably pay closer attention if others complain as well.

Michael


Sent from my iPad

On Oct 23, 2011, at 6:25 AM, Robert McHugh <bob_mchugh_2000@yahoo.com> wrote:

> The following code takes over a minute to run on my machine.  Is this expected behavior?
>
> t = {"14-May-10 09:58:05", {"Day", "-", "MonthNameShort", "-", "YearShort", " ", "Hour", ":", "Minute", ":", "Second"}};
> tList = Table[t, {i, 100000}];
> a = Timing[AbsoluteTime[#] & /@ tList ;]
>
> For reference, an operation like the following takes less than a tenth of a second. (Of course this second example needs quite a bit of modification to provide a correct answer, but it does show how fast the program can operate on a large list.)
> t = {14, 5, 10, 9, 58, 05};
> tList = Table[t, {i, 100000}];
> a = Timing[( ((#[[3]] 0 + #[[2]] 30 + #[[1]]24) + #[[4]]) 60 + #[[5]]) 60 + #[[6]] & /@ tList;]
>
> Some background: am analyzing some historical data (about 500 000 records, one data point a minute for about a year) and am making a few utilities to retrieve the data for any given time interval.   My original plan was to change the time stamp to absolute time and then use a select statement.  This step in the above example, changing the time stamps to absolute time, is the rate limiting step in the code (everything else runs in about 5 seconds).
>
> Was wondering if someone could explain why AbsoluteTime[] is relatively slow operation and perhaps some faster operations for date and time comparisons.
>
> Thanks
>

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: runs slowly? Michael Stern <nycstern@gmail.com> - 2011-10-24 09:13 +0000
  Re: runs slowly? Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-10-25 10:22 +0000
    Re: runs slowly? Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-10-26 21:45 +0000
  Re: runs slowly? DrMajorBob <btreat1@austin.rr.com> - 2011-10-27 10:30 +0000

csiph-web