Difference between revisions of "User:Void Singer/Optimizations"
Jump to navigation
Jump to search
Void Singer (talk | contribs) m (reworking user page) |
Void Singer (talk | contribs) m (cleanup) |
||
Line 1: | Line 1: | ||
<div id="box"> | <div id="box"> | ||
== Coding Practices: Optimizations == | |||
<div style="padding: 0.5em"> | <div style="padding: 0.5em"> | ||
This is a list of current coding optimizations and "hacks" I use in LSL and in examples | This is a list of current coding optimizations and "hacks" I use in LSL and in examples | ||
They are all [[LSL_Script_Efficiency#How_Fast_Does_That_Code_Run|tested]] personally | They are all [[LSL_Script_Efficiency#How_Fast_Does_That_Code_Run|tested]] personally | ||
Line 24: | Line 24: | ||
<div id="box"> | <div id="box"> | ||
== Comments == | |||
<div style="padding: 0.5em"> | <div style="padding: 0.5em"> | ||
Feel free to leave me a note on my [[User_talk:Void_Singer|User Talk]] page. | Feel free to leave me a note on my [[User_talk:Void_Singer|User Talk]] page. | ||
</div></div> | </div></div> |
Revision as of 02:36, 1 December 2007
Coding Practices: Optimizations
This is a list of current coding optimizations and "hacks" I use in LSL and in examples They are all tested personally
- when testing a function that returns -1 on NOT_FOUND
- use (~test_function) -[eg. if (~llSubStringIndex( "abcdef", "t")){
- instead of (test_function != -1) -[eg. if (llSubStringIndex( "abcdef", "t") != -1){
- because it runs faster -[(!~test_function) also works for FOUND
- when testing a list for a specific single entry
- use llListFindList( vLstBase, (list)"test" )
- instead of llListFindList( vLstBase, ["test"] )
- because it runs faster and smaller compiled -[eg. if (llListFindList( vLstBase, (list)"test" )){
- when incrementing counters or variables
- use (++vIntCount)
- instead of (vIntCount++) or (vIntCount += 1) or (vIntCount = vIntCount + 1)
- because it runs faster
- When testing if/else conditions place true statement first if possible
- use (test) or (test == value)
- instead of (!test) or (test != value)
- because it's clearer & faster
- Other Useful Optimizations
Comments
Feel free to leave me a note on my User Talk page.