Measuring script execution speed
|
|
Oberon Onmura
Registered User
Join date: 28 Dec 2006
Posts: 125
|
04-01-2009 11:33
Hi -
If I make a script, say, that takes the time, counts to a million, takes the time again, and then subtracts time1 from time2, I get an output of a certain number of seconds.
What am I actually measuring here? Assuming, say, that I am floating at 3000 meters and not downloading any textures, am I seeing any kind of valid comparative measure of script execution speed?
Thanks!
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
04-01-2009 11:49
From: Oberon Onmura What am I actually measuring here? Not a lot really, just the beginning and end times. Unfortunately it's notoriously hard to get a really good measure of how fast a script can get its work done, because scripts are near the bottom of the totem pole for getting a shot at the CPU, and they have to share a limited time slice with all the other scripts running on the sim. From: someone Assuming, say, that I am floating at 3000 meters and not downloading any textures, am I seeing any kind of valid comparative measure of script execution speed? Those won't really have a bearing on script execution. It takes some heat off what your viewer has to render, but the script still has to compete with the stuff happening on the ground or elsewhere on the sim. the timers you see with shift-ctrl-1 are a little more helpful. If the frame rate is near 45 and time dilation near 1.0, you have a lightly loaded sim and a better shot at an accurate result. You can also expand the timers at the bottom of that panel to see how much load there is.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-01-2009 19:33
you are measuring how fast the code between your get time statements run on the sim you are on. in addition to what viktoria said this might help http://wiki.secondlife.com/wiki/LSL_Script_Efficiency#How_Fast_Does_That_Code_Run
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
04-01-2009 21:49
hmm that micro-optimization stuff probably needs a revisit for mono to check what matters, huh?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-02-2009 05:34
the whole page does really.... for instance the memory saving optimization isn't supposed to work under mono. maybe if I get bored I'll attack some of it.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Oberon Onmura
Registered User
Join date: 28 Dec 2006
Posts: 125
|
04-02-2009 11:58
From: Viktoria Dovgal Not a lot really, just the beginning and end times. Unfortunately it's notoriously hard to get a really good measure of how fast a script can get its work done, because scripts are near the bottom of the totem pole for getting a shot at the CPU, and they have to share a limited time slice with all the other scripts running on the sim. Right - makes sense. Still, I get different outputs in different sims. In other words, the script runs faster in some sims and slower in others. So ... even just as a rough momentary sim to sim comparison, can't I say that I'm measuring something? 
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
04-02-2009 14:01
From: Oberon Onmura Right - makes sense. Still, I get different outputs in different sims. In other words, the script runs faster in some sims and slower in others. So ... even just as a rough momentary sim to sim comparison, can't I say that I'm measuring something?  Sure you can say that, but it can be hard to say exactly what it is you are measuring! 
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
04-02-2009 16:12
Don't know what all of the hulaballoo is about. Using script time to measure performance works just fine. Find an empty sim, such as a new island or go to Aditi and find an empty sim. TP around until you find one running around 1.0 ms of script time and then run your script multiple times to get an average reading. You can use it to see how different changes in a script make it more or less efficient. LLGetTime was what we all used to see the difference between LSL and MONO and red flagged how MONO treats state changes for example.
Keep on being curious and experimenting Oberon. It is the mark of a future great scripter when they get to the point of worrying about sim resources and how to make their scripts work better, instead of just working.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|