Fixing slow scripts

Creating scripts
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Fixing slow scripts

Post by Graham Mills »

Taking them off the market seems a little precipitate. Danger of over-reacting here...
Marstol Nitely wrote:The Nitely chandeliers can be turned on and off, so maybe a disclosure about the script time and a suggestion to keep them off when not in use? Not sure what I'll do, but I've taken them off the market for now.
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Fixing slow scripts

Post by Graham Mills »

Well, the particle scripts still show in the top scripts but the score is much diminished. More to the point, they show up despite being disabled yesterday? To be fair I didn't do a restart then so I can't say that disabling via the top scripts dialog worked then either. UPDATE just checked again, disabling that way doesn't persist across a sim restart.
User avatar
Marstol Nitely
Posts: 480
Joined: Mon Dec 24, 2012 1:42 am
Has thanked: 1019 times
Been thanked: 432 times

Re: Fixing slow scripts

Post by Marstol Nitely »

Re-checked after update and script count on grandfather clock and chandelier is negligible. Chandelier seems to surge a tiny bit (still under 1) when turning flame on and off and there's a little activity upon opening grandfather clock door and starting pendulum but the numbers are much lower than yesterday and everything settles back down almost immediately. Both are back on the market. Whew! Thank you Oren and Kayaker.

You are entitled to your opinion Graham. For my part, I'd rather deactivate something while I find a solution than knowingly sell something I know could cause problems for my customers. I was hoping to find a solution and some understanding of what was causing the problem. At the very least I would have wanted to add a disclosure to the items descriptions and instructions. Thanks (again) to Oren, the only action required on my part was hitting the "activate" button.
These users thanked the author Marstol Nitely for the post:
Alexina Proctor
User avatar
Marstol Nitely
Posts: 480
Joined: Mon Dec 24, 2012 1:42 am
Has thanked: 1019 times
Been thanked: 432 times

Re: Fixing slow scripts

Post by Marstol Nitely »

My understanding of how this new tool works is not quite where it needs to be and neither is my chandelier. At the risk of Graham thinking I'm having a knee jerk reaction, I've hit the deactivate button on it again.

When look at the Statistics box my chandelier causes a brief spike of 0.030 when I pull it out of inventory or turn it off/on. However, in Region/Estate, Debug, Top Scripts the chandelier doesn't come up when it is off, but comes up at different times during a few checks 7.000, 15.000 and as high as 18?
User avatar
Dot Matrix
Posts: 1625
Joined: Sun Jul 28, 2013 3:26 am
Has thanked: 1209 times
Been thanked: 2324 times

Re: Fixing slow scripts

Post by Dot Matrix »

From the blog:
Oren wrote:The first thing you need to check is the Statistics panel. You can open this panel by pressing Ctrl+Shift+1 in the viewer. The panel shows many statistics, but the two most important statistics are the Physics Time and Script Time. [Scroll down to see them.]

The “Script Time” value now shows the amount of time spent executing the world’s scripts in the last frame. This value should usually be very low: ideally under 1 ms.
The blog post says "...a Script Time under 1 ms is a good result", and cites the Script Time of the Kitely Welcome Center, which is 0.536.

In this latest version, I've tried taking out two Grandfather Clocks, two (lit) Chandeliers and two Ahnonay Clocks -- the latter previously had very high "Top Script" values. The Script Time now varies mostly between 0.034 ms and 0.150 ms with very occasional jumps to 2.8 ms. For the Region Debug Top Scripts I get similar numbers to Marstol.

Given this, the chandelier and working clocks are going back out -- maybe not in vast numbers, but where they help to enhance the environment.
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4970 times
Been thanked: 4469 times
Contact:

Re: Fixing slow scripts

Post by Ilan Tochner »

Hi Dot,

It is worth noting that sim lag is not only affected by script runtime but also by the amount of network and storage activity that is created by the scripts. For example, a script that constantly changes the world state requires every such change to be transmitted to every avatar currently connected to that world. I would advise to keep that in mind when using scripted objects.
These users thanked the author Ilan Tochner for the post:
Alexina Proctor
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4970 times
Been thanked: 4469 times
Contact:

Re: Fixing slow scripts

Post by Ilan Tochner »

Hi Graham,

Thank you for bringing this to our attention. We'll look into persisting script state (enabled/disabled) between world restarts.
These users thanked the author Ilan Tochner for the post:
Alexina Proctor
User avatar
Dot Matrix
Posts: 1625
Joined: Sun Jul 28, 2013 3:26 am
Has thanked: 1209 times
Been thanked: 2324 times

Re: Fixing slow scripts

Post by Dot Matrix »

Ilan Tochner wrote:It is worth noting that sim lag is not only affected by script runtime but also by the amount of network and storage activity that is created by the scripts. For example, a script that constantly changes the world state requires every such change to be transmitted to every avatar currently connected to that world.
Is there a way of spotting when this is happening?
User avatar
Kayaker Magic
Posts: 354
Joined: Sun Dec 01, 2013 8:40 am
Has thanked: 52 times
Been thanked: 393 times

Re: Fixing slow scripts

Post by Kayaker Magic »

Oren Hurvitz wrote:In particular, sleep time is no longer counted as part of the script time, since it doesn't use the CPU.
I'm not sure this is a good thing, now scripts are no longer punished in Top Scripts for calling llSleep and locking up the script threads.
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4970 times
Been thanked: 4469 times
Contact:

Re: Fixing slow scripts

Post by Ilan Tochner »

Hi Dot,

If the objects that are changed/moved are non-Phantom then they may show in Top Colliders or the sim's Physics FPS may decrease from its baseline. However, the best way to spot such problems is to consider what you are rezzing. If the item changes then that information needs to be transferred to viewers. That said, there are certain types of changes that don't need a constant update as they are set in motion once and don't require updating viewers until they are changed again. For example, avatar animations, texture rotation using object properties, etc. only require updating the viewer once for the viewer to be able to display the desired movement.

In physical terms, consider a frown ball without friction or other external forces acting on it. Once you know the vector you don't need to update the viewer again until the ball has another force acting on it. Compare that to a bird that is constantly changing course. Every such course change requires updating all the viewers that have that bird "in their sights". Try to minimize using objects that require continuous repeated updates. If you do use them then do so sparingly to leave enough server resources to deal with everything else that your sim needs to handle at the same time. The alternative is to accept that you'll get lag with a lot less avatars inworld than you could have accommodated otherwise.
These users thanked the author Ilan Tochner for the post:
Alexina Proctor
Post Reply