User talk:Omei Qunhua
An appeal:
When submitting sample scripts (or editing existing samples) PLEASE ensure you've tested the resulting script. There can be no excuse for blindly editing and not testing, and certainly no excuse for submitting scripts that won't even compile! Omei Qunhua 09:02, 9 December 2012 (PST)
- I wholeheartedly agree. I have been guilty of the sin but I agree. lslint and lsleditor are our friends. I noticed you mentioned that some edits have been breaking examples. If that happens, please make a note of it somewhere, we need to keep track of this so we can halt any negative trends. -- Strife (talk|contribs) 08:34, 14 December 2012 (PST)
- Well if you want to observe a negative trend, the following Wiki pages / examples were all corrupted by the same person :)
Wiki Page Date Corrupted Nature of Error Gun Script 18-Oct-12 Compile error llGetAgentList 8-Dec-12 Compile error llGetAgentList 9-Dec-12 Run-time bad results llDialog 24-Sept-12 Compile error 11SetLinkAlpha 30-Sept-12 Compile error llGetLinkInventoryPermMask 25-Nov-12 Compile error llResetOtherScript 24-Sept-12 Run-time error llGetSimStats 8-Dec-12 Compile error llRequestURL 24-Sep-12 Compile error llSetKeyframedMotion 24-Sep-12 Run-time error llEvade Compile error llGetClosestNavPoint Compile error llGetNotecardLine Run-time bad results llAcos Incorrect misleading comment
Omei Qunhua 15:26, 18 December 2012 (PST)
- I have take a look at all his changeings in the example scripts and do not agree with the most, Everywhere he remove inside the sub-if's the clamps and resort the events. The most of the experienced scripters do not realy read it, but for beginners i think its bad when they not see where are the clamps necessary and where not. Daemonika Nightfire 10:19, 20 December 2012 (PST)
More size constructs
I've confirmed your results and made a few more tests of size optimization constructs.
x=-~x; 6 bytes (equivalent to ++x) x=~-x; 6 bytes (equivalent to --x) y=-~x; 6 bytes (equivalent to y=x+1) if(~x); 7 bytes (equivalent to if(x!=-1)) x*2; 8 bytes (equivalent to x<<1) x=-~-~x; 8 bytes (equivalent to x+=2) x=~-~-x; 8 bytes (equivalent to x-=2) y=x+1; 10 bytes x=x*2; 10 bytes (equivalent to x=x<<1) x*=2; 10 bytes if (!~x); 10 bytes (equivalent to if(x==-1)) if(x&0x80000000) 12 bytes (equivalent to if(x<0) for integers) if(x<0); 13 bytes x=x<<1; 14 bytes if(x!=-1); 17 bytes
For float x:
x=0; 9 bytes x=0.0; 12 bytes
For vector x:
x=<0, 0, 0>; 27 bytes x=<0.0, 0.0, 0.0>; 36 bytes x=ZERO_VECTOR; 36 bytes
for list x:
llGetListLength(x); 40 bytes x!=[]; 13 bytes (note: only list LENGTH is compared - actually subtracted. That returns 0 for empty list.) x==[]; 13 bytes if(x==[]); 17 bytes if(x!=[]); 17 bytes x!=[""]; 23 bytes (note: only list LENGTH is compared - actually subtracted. That returns -1 for empty list.) x==[""]; 23 bytes (true if x has 1 element) x!=[[]]; 23 bytes (list may not contain lists but this is allowed?!?!) x==[[]]; 23 bytes if(x==[""]); 27 bytes x!=[1]; 28 bytes (true if x has 1 element) if(x==["","",""]); 47 bytes if(x!=["","",""]); 47 bytes if(llGetListLengt(x)==1); 53 bytes if(llGetListLengt(x)!=1); 56 bytes if(x==["","","",""]); 57 bytes
Some of those may be worth being included in LSL Hacks, which I'd say is the place for code size optimization. Your list results are run time size related and thus worth being included as an update to LSL Script Memory. --Pedro Oval 09:35, 29 December 2012 (PST)
- Wow some of those are really interesting. I would venture the reason float zero is so expensive is how it's being encoded (there are several ways to encode floats in IL). They haven't optimized the zero case. I'm very surprised that x * 2 is less than x << 2. -- Strife (talk|contribs) 13:28, 29 December 2012 (PST)