Timing Scripts... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timing Scripts... (
/showthread.php?tid=199754)
Timing Scripts... -
Ash. - 16.12.2010
I've just realised it was on the wiki...
Thanks anyway 
- Ash
Hi all
A lot of talk about Code Optimization (especially from ******

) has got me thinking about my own scripts, and i was thinking of running a seed test on some of my functions and commands. But i have forgotten how to do it. I know it was posted on one of ******' threads before, however i can no longer find that specific thread. Can anyone point me to that thread, or tell me how to do it?
I know its something to do with either tickcount(granularity) or GetTickCount()
Thanks
Ash
Re: Timing Scripts... -
bigcomfycouch - 16.12.2010
You could do it a few ways
pawn Код:
new
t;
t = GetTickCount( );
for ( new i; i < 500000; ++i )
{
func( );
}
printf( "%i", GetTickCount( ) - t );
or
pawn Код:
func( )
{
static
t;
printf( "%i", GetTickCount( ) - t );
t = GetTickCount( );
// code
}
Re: Timing Scripts... -
Ash. - 16.12.2010
Thanks, however i know now thanks to the wiki, and you!
I'd edited my first post before you posted though.