Tattooshop Posted May 2, 2020 Share Posted May 2, 2020 Question about AVsitter scripts. why at the beginning of the script is a long comment representing the code partially or completely repeating the code itself? can this comment be removed and will it affect performance? I noticed that the script has been loading for quite long time when you try to open it. Is it also possible to rename scripts in this set? Link to comment Share on other sites More sharing options...
sandi Mexicola Posted May 2, 2020 Share Posted May 2, 2020 The commented out part might be due to automatic script optimization. There's a way to do that in Firestorm at least, if not other viewers. What happens is the original code is commented out and replaced by optimized code. For example, unused variables and functions might be removed, resulting in smaller, faster code. Please pardon me for not remembering all the details of how that gets set up. As for long load time and renaming scripts, I have no idea. 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted May 2, 2020 Author Share Posted May 2, 2020 13 minutes ago, sandi Mexicola said: The commented out part might be due to automatic script optimization. There's a way to do that in Firestorm at least, if not other viewers. What happens is the original code is commented out and replaced by optimized code. For example, unused variables and functions might be removed, resulting in smaller, faster code. Please pardon me for not remembering all the details of how that gets set up. As for long load time and renaming scripts, I have no idea. Thank you! So this comment can be deleted? So any script can be optimized like that in Firestorm? Do you know how to do this? Really want to try! Link to comment Share on other sites More sharing options...
sandi Mexicola Posted May 2, 2020 Share Posted May 2, 2020 Well, technically, any comment can be deleted in LSL script. I set it up a few years ago now, seems like, and I don't remember what I did. However, I can log in and take a look. I don't think it's that hard to set up. 1 Link to comment Share on other sites More sharing options...
sandi Mexicola Posted May 2, 2020 Share Posted May 2, 2020 Here, it looks like I just checked these two boxes: http://prntscr.com/s9mur9 And there is information on the FS wiki here: https://wiki.firestormviewer.org/preferences_firestorm_tab#lsl_preprocessor 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted May 2, 2020 Author Share Posted May 2, 2020 9 minutes ago, sandi Mexicola said: Here, it looks like I just checked these two boxes: http://prntscr.com/s9mur9 And there is information on the FS wiki here: https://wiki.firestormviewer.org/preferences_firestorm_tab#lsl_preprocessor Thank you! 1 Link to comment Share on other sites More sharing options...
sandi Mexicola Posted May 2, 2020 Share Posted May 2, 2020 Sure, no problem! 1 Link to comment Share on other sites More sharing options...
Qie Niangao Posted May 2, 2020 Share Posted May 2, 2020 I'm pretty sure the commented-out code in the AVsitter package is the same as the OpenSim version of those scripts (because the LSL PyOptimizer doesn't work for OpenSim) -- which is another way to say it doesn't rely on any of the more elaborate extensions and optimizations that apply to source that can't compile without the preprocessor. The reason this might be of interest is that the unoptimized source is a whole lot easier to read (the variable and function name symbols are meaningful) and it's possible to use that commented-out source instead of the optimized stuff that follows, with a generally negligible increase in memory footprint, at least in my experience. And the reason you might want to do that is it's sometimes possible to add functions to one of the AVsitter scripts instead of adding a whole separate script of your own, or to combine some of the special-purpose AVsitter scripts into one, saving vastly more memory and sim overhead than could any static code optimizer. It's a whole lot easier to extend or combine source you can actually read. 2 1 Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted May 2, 2020 Share Posted May 2, 2020 (edited) 3 hours ago, Tattooshop said: Thank you! So this comment can be deleted? So any script can be optimized like that in Firestorm? Do you know how to do this? Really want to try! The LSL Preprocessor doesn't exactly "make your code better," definitely not faster. In fact it arguably does some damage for those who aren't using that feature. What it does optimize is unused code, which it removes. What it also does but shouldn't, is remove comments. (Meaning anyone not using the preprocessor won't see them.) The Preprocessor is a text-replacer, essentially. Its main features are #include to import code from your computer, and #define to create "immutable constants" rather than variables. It does also provide some quality of life things like lazy lists, but I recall it having its own set of edge-cases. For example, this is what the post-processed code looks like: //start_unprocessed_text /*string unused = "Goodbye, World!"; default { state_entry() { /|/ This is a comment! llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { llSay(0, "Touched."); } } */ //end_unprocessed_text //nfo_preprocessor_version 0 //program_version Firestorm-Releasex64 6.3.2.58052 - Wulfie Reanimator //last_compiled 05/02/2020 05:34:16 //mono default { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { llSay(0, "Touched."); } } And if you are using the Preprocessor, the unprocessed code is in a separate tab from the post-processed one. Edited May 2, 2020 by Wulfie Reanimator 2 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted May 3, 2020 Author Share Posted May 3, 2020 (edited) @Qie Niangao @Wulfie Reanimator Thank you! And if I delete this commented unprocessed code will it speed up performance? I noticed that the script loads for a very long time when I try to open it, and it makes it twice longer, and do comments affect performance at all? Edited May 3, 2020 by Tattooshop Link to comment Share on other sites More sharing options...
Qie Niangao Posted May 3, 2020 Share Posted May 3, 2020 Oh, loading the script into the editor? Yeah, that'll happen twice as fast if you delete the commented code (or use it instead of the optimized code, either way). The runtime performance will be the same, though, with or without comments (although compiling the source may take a tiny bit longer with comments to skip through. One thing about programs that make heavy use of notecard configuration files (which at first I mistakenly thought was the question) - they can take a really long time to load the data from those notecards, and that will be slowed by comments and even blank lines in the notecard (not in the script). 1 Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted May 4, 2020 Share Posted May 4, 2020 14 hours ago, Tattooshop said: @Qie Niangao @Wulfie Reanimator Thank you! And if I delete this commented unprocessed code will it speed up performance? I noticed that the script loads for a very long time when I try to open it, and it makes it twice longer, and do comments affect performance at all? Comments don't affect script performance in any way. They're never included in the compiled code. Unused code doesn't affect script performance either, besides adding to the total memory use of the script. 1 Link to comment Share on other sites More sharing options...
Lindens Rider Linden Posted May 4, 2020 Lindens Share Posted May 4, 2020 On 5/2/2020 at 3:54 AM, Tattooshop said: Question about AVsitter scripts. why at the beginning of the script is a long comment representing the code partially or completely repeating the code itself? can this comment be removed and will it affect performance? I noticed that the script has been loading for quite long time when you try to open it. Is it also possible to rename scripts in this set? Comments will never affect script performance. LSL is compiled into byte code and that is what is actually executed, comments are not included in the byte code. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now