Skip to main content
Participant
March 1, 2010
Question

Optimizing & timing scripts?

  • March 1, 2010
  • 2 replies
  • 824 views

Hey all,

I'm trying to optimize a script, is there some way to time the script to see how it's performing.

Also, if anyone has any tips or links on how to improve script performance, that'd be great!

Cheers,

- Kevin

This topic has been closed for replies.

2 replies

Inspiring
March 1, 2010

ESTK has an entire Profile menu for just this kind of thing.

kevin_canAuthor
Participant
March 2, 2010

Thanks for all the replies.

Cheers for the Profiling tip too - I wasn't familiar with that term, so got that working too, and am able ot tweak the script now and am trying to impove it.

Cheers!

Inspiring
March 1, 2010

I think the norm for timing would be get date at start and get date at end of process. Then minus start from end something like this…

#target photoshop]

app.bringToFront();

var startTime = new Date();

$.writeln(startTime);

delay(); // do some thing here

var endTime = new Date();

$.writeln(endTime);

// Milli-seconds to seconds

alert((endTime - startTime) / 1000);

function delay() {

$.sleep(3000);

}

btw date is milliseconds

kevin_canAuthor
Participant
March 1, 2010

That's great - that's really helped already.

If you or others have any other general optimization tips - i'd be delighted to hear them.

Inspiring
March 1, 2010

I don't know very much about the memory overheads of differing methods Im sure others will provide you with info on that.

Im CS2 so use scriptlistener to change my workspace (to palletless) I think you can toggle in newer versions.

Also cut down history steps to only those needed by the script.