Jump to content

AVsitter question


Tattooshop
 Share

You are about to reply to a thread that has been inactive for 1452 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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

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. :)  

  • Thanks 1
Link to comment
Share on other sites

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! :D

 

 

 

Link to comment
Share on other sites

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.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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! :D

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 by Wulfie Reanimator
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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).

  • Thanks 1
Link to comment
Share on other sites

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.

  • Thanks 1
Link to comment
Share on other sites

  • Lindens
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.

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1452 days.

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
 Share

×
×
  • Create New...