mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
No description
Well, within reasonable limits. For break, it's explained in the code. If the block is empty of actual code (code that generates output), then the break position is eliminated. For default, if the default label is at the top of the block, the jump and the label are both eliminated. This check doesn't include verifying that there are other non-code-generating statements in between, so there's room for improvement (added corresponding TODO item). This way, we're on par with FS, in case someone (ab)used the FS brokeness when the 'default' label was absent. All one has to do now is add the default label at the top, and the generated code will be the same as it was in FS when abusing that bug, with no extra burden. Example: In FS, the code at the top acted as default and there was no jump for it: default { timer() { switch(1) { 0; case 1: 1; } }} This generated roughly: default { timer() { { if (1 == 1) jump CASE_1; 0; @CASE_1; 1; } }} In this system, it would trigger an error by default. To obtain the FS behaviour, the scripter can do instead: default { timer() { switch(1) { default: 0; case 1: 1; } }} Thanks to this optimization, the code will be the same as in FS. Without it, an extra default label and corresponding jump would be present. |
||
---|---|---|
lslopt | ||
.gitignore | ||
builtins-unittest.txt | ||
builtins.txt | ||
COPYING | ||
main.py | ||
README.md | ||
seftable.txt | ||
testfuncs.py | ||
testparser.py |
LSL PyOptimizer
LSL PyOptimizer is a LSL2 script optimizer written in Python 2. Currently it only supports code memory optimization (no speed optimization), only for Mono (no LSO), and only for the Second Life flavour of LSL (no OpenSim etc.).
HTML introduction, list of features and documentation available at http://lsl.project.li/lsl-pyoptimizer/