The LSL Plus IDE (0.10.0) has added support for inlining and some other optimizations (constant folding, mostly) for scripts. The basic idea is you edit, test, and otherwise manage your code out-of-world, but use the optimized scripts in-world. If you find a problem with a script in-world, you edit the source script, recompile out-of-world, and reupload. A sample:
Source script (maintained in your IDE):
float miles2feet = 5280.0;
float meters2feet = 3.2808399;
// pragma inline
float pythagorean(float a, float b) {
return llSqrt(a * a + b * b);
}
default {
state_entry() {
llOwnerSay((string)(pythagorean(6000.0,3000.0) / miles2feet));
vector v = llGetPos();
llOwnerSay((string)(pythagorean(v.x * meters2feet, v.y * meters2feet) / miles2feet));
}
}
'Compiled' script, with various optimizations.
// LSL script generated: Tue Feb 3 22:01:51 Eastern Standard Time 2009
default {
state_entry() {
llOwnerSay("1.270493"
;vector v = llGetPos();
float a = (v.x * 3.2808399200439453);
float b = (v.y * 3.2808399200439453);
llOwnerSay(((string)(llSqrt(((a * a) + (b * b))) / 5280.0)));
}
}
The inlining optimization is controlled with the 'pragma inline' notation placed before the function you want to have inlined. This feature interacts well with the LSL Plus module system: you can place many, short, useful functions into a common module, annotate them with the inline pragma, and then use them throughout your scripts, knowing that the call overhead will be optimized away.
The Windows and Linux versions of LSL Plus are ready now, the Mac version is pending...
http://lslplus.sourceforge.net


