system dates & speed

Sarah Reichelt sarahr at genesearch.com.au
Tue May 25 00:37:02 EDT 2004


I was writing a charting routine today and after I had added a section 
that converted seconds to dates or times for display purposes, the 
handler became much slower. After a series of timing tests, I found 
that for 200 lines of data, Rev was taking nearly 20 milliseconds to 
convert one item from each into short system time and slightly longer 
for short system date. This was with a repeat for each loop, appending 
the altered data to a new variable and every other speed trick I could 
think of.

When I had almost run out of ideas, I removed the word "system" from 
the date & time conversions. The time taken was immediately halved! 
However while diagnostic, this was not helpful because I have to show 
people dates in the format they expect, so instead of explicitly doing 
my conversion to system formats, I set the useSystemDate to true. This 
maintained the improved speed, or at least most of it.

The moral of the story is, that if you are doing lots of dateTime 
conversions, set the useSystemDate instead of specifying the system 
format in the convert command.

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/

P.S. For anyone wondering why I am so concerned with speed, each 
individual chart is fine, but I may need to have a lot of charts 
displayed at the same time, so every tick counts.



More information about the use-livecode mailing list