Difference between revisions of "Efficiency Tester"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
If you don't like it, sue me :P. | If you don't like it, sue me :P. | ||
< | <pre> | ||
integer time() { | integer time() { | ||
string stamp = llGetTimestamp(); | string stamp = llGetTimestamp(); | ||
Line 25: | Line 24: | ||
} | } | ||
} | } | ||
</pre> |
Revision as of 05:57, 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."); } }