Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 1:37 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Execute speed of scripts
PostPosted: March 24th, 2005, 3:44 pm 
Offline

Joined: January 19th, 2005, 5:15 pm
Posts: 83
Location: Netherlands
Is there any way to get the (parse) time a script needs to execute. For my convenience i combined some scripts tot one main script. Now this script exists of many functions, and is about 700 lines long. Actually not really big, but some pages are getting a little bit slow.

So I wanted to test the differences between long and short script, but like to have some hard numbers with that.

And could there be any noticable differences between an 200 or 700 line script (without really weird stuff in there that could take a lot of time).


Top
 Profile  
 
 Post subject:
PostPosted: March 24th, 2005, 4:04 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

One way to achieve this would be to insert the following script actions at the start and at the very end of your script:

Code:
var myDate = new Date()
var hour = String.format("02.0",myDate.getHours())
var mins = String.format("02.0",myDate.getMinutes())
var secs = String.format("02.0",myDate.getSeconds())
time = hour+":"+mins+":"+secs
Debug.trace(time + "\n")


When the publication is run, these actions should cause a script output window to appear displaying the current time in the format hh:mm:ss. Once the script has completed, the actions at the end of the script should add the current time underneath the first and you should be able to determine how much time has elapsed.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 24th, 2005, 4:47 pm 
Offline

Joined: January 19th, 2005, 5:15 pm
Posts: 83
Location: Netherlands
The smallest difference it will display is a second (or none). I really hope no page will take more than a second to load.

Is there any way to get the time-difference from start to end of script in microseconds or milliseconds?


Top
 Profile  
 
 Post subject:
PostPosted: March 24th, 2005, 4:59 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Try the following:

Code:
var myDate = new Date()
var hour = String.format("02.0",myDate.getHours())
var mins = String.format("02.0",myDate.getMinutes())
var secs = String.format("02.0",myDate.getSeconds())
var millisecs = myDate.getMilliseconds()
time = hour+":"+mins+":"+secs+":"+millisecs
Debug.trace(time + "\n")


This should display the times in hh:mm:ss:mmm format and should allow you to check how long it took for the script to complete.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 45 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group