Efficiency Tester: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
This code will test the efficiency of what ever is in the while loop. | This code will test the efficiency of what ever is in the while loop. | ||
I've used i += 1 because it was found to be faster on the [LSL Script Efficiency]] page. | I've used i += 1 because it was found to be faster on the [[LSL Script Efficiency]] page. | ||
If you don't like it, sue me :P. | If you don't like it, sue me :P. | ||
Revision as of 05:58, 16 May 2007
This code will test the efficiency of what ever is in the while loop.
I've used i += 1 because it was found to be faster on the LSL Script Efficiency page.
If you don't like it, sue me :P.
integer time() {
string stamp = llGetTimestamp();
return (integer) llGetSubString(stamp, 11, 12) * 3600000 + (integer) llGetSubString(stamp, 14, 15) * 60000 + llRound((float)llGetSubString(stamp, 17, -2) * 1000000.0)/1000;
}
default {
state_entry() {
float i = 0;
float max = 10000;
float current = time();
while (i < max) {
i += 1;
}
float t = (time()+-current)/max;
llOwnerSay("The function in the loop took a total of " + (string)t + " milliseconds.");
}
}