Jump to content

Sim performance impact of script set to "not running"


Hooten Haller
 Share

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

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

Recommended Posts

On 5/21/2023 at 5:23 AM, Qie Niangao said:

It does use memory because the script still resides in the simulator. It does not use any processor time.

Maybe a technicality depending on use-case, but…  I think that depends on when/where it was set to not running.

A script set to running, and then not running, does in fact retain it's memory, and it's entire state.  If you set it running again, it'll resume where it left off.

But take it out of the sim (like by TP,  or derez, or whatever) while it's not running, and then start it again, and it has to start from scratch — suggesting the script state/memory (at least, other than bytecode) is not retained in that situation.  Which is good news for HUDs being worn by someone who does a lot of sim-hopping, or an object being rezzed with several "modules" and then starting only the one appropriate to the situation.

Does still leave the question of if we know whether a script that has not been running at all in the current sim session, occupies any memory?  Does the sim even bother to fetch it's bytecode, if it's not yet been set to running?  If not, then until it's started at least once in the current sim session, it only occupies the small amount of space taken up by the inventory entry.

Link to comment
Share on other sites

So, I went and did a very quick test…  (In case it's changed recently — has been known to happen.)

Made a script in a box that counts, attached it, still counting.  TP'd to another sim, still counting.  Stopped it, TP'd home, started it again, it resets and counting from scratch.

I've been wearing a "general purpose" HUD I made like over a decade ago now (always makes me feel old, saying things like that), that stops most of it's scripts once they've announced themselves, until they're needed again (they register their menu entry, and subscribe to a couple wakeup events as needed, etc.), and I rather distinctly remember using another script as a "settings store" for them (though only a few actually needed it)…  I plan to rework that whole thing; LSD for one, will let me ditch the settings store script.  Plus I've just plain gotten better at LSL in general, over that time.  (It's on the TODO list…  the very very long TODO list…)

But yeah, TP's also.  Basically, any time you bring a stopped script into a sim, it doesn't bring it's current state blob with it.  And not having its current state, seems to basically be what a script reset is — it's gotta build a new one from scratch, next time it gets to run.

(Not sure about a rezzed object, and a sim restart…  Kinda hard to test that one.)

Link to comment
Share on other sites

5 minutes ago, Bleuhazenfurfle said:

 

So, I went and did a very quick test…  (In case it's changed recently — has been known to happen.)

Made a script in a box that counts, attached it, still counting.  TP'd to another sim, still counting.  Stopped it, TP'd home, started it again, it resets and counting from scratch.

 

I understand what you are saying. Sorry, it just doesn't make sense. That's ok, I don't need to understand, I'll just do a test myself so I maintain a shred of sanity.

What you didn't say is if the box was attached to your avatar the entire time. I assume you didn't take it into inventory.

Yes, using LSD has fixed most all my "script State" issues, I basically use the LSD to preserve my State.

Thanks!

 

Link to comment
Share on other sites

Yeah, attached the whole time.  Inventory "freezes" the script, complete with it's current state.  That doesn't count as "stopped".

Same thing happens when crossing sim borders or TPing with a running script.  Its current state gets packaged up into a blob, sent along with it, and unpackaged on the other side.  But, if stopped…  SL just goes, "yeah, nah, not gonna bother".

Also untested…  Stopping, and then taking to inventory and re-rezzing…  With and without a sim change.  Could be interesting.  But not worth actually testing it.

Edited by Bleuhazenfurfle
Link to comment
Share on other sites

Yeah, I was trying to keep things simple in my earlier response, but even without leaving the region a script set not running will lose state memory when the sim restarts.

That's another use case for Linkset Data I suppose.

Edited by Qie Niangao
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 348 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...