Game Development Community

Measuring script execution speed?

by daffodilistic · in Torque Game Builder · 10/21/2010 (7:51 am) · 1 replies

Hi all,

I've been working on TorqueScript, and I'm trying to optimize certain parts of the script. I'm wondering if there's a profiler or some cycle/tick-measuring function that I can use to check how fast a particular set of code take? Thanks alot.

#1
10/22/2010 (2:40 pm)
Pretty simple.

Put the following where you want to start measuring, such as the first line in a function:
$startTime = getRealTime();
Then put the following where you want to stop measuring, such as at the end of a function:
echo("Executed in" SPC getRealTime() - $startTime SPC "ms.");