Oct 24 list of Script Sizes and essay on script-sim performance impact
|
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
|
10-24-2006 10:39
The only other time I've posted my list of script sizes was in response to somebody's question here. Since then, several popular gadgets have been updated by the builders (and in one case pheonomenally improved-the psiTEC II) and my personal collection has grown. So here it is, without further comment, my notecard on Script Sizes that I keep in game and routinely hand out to interested folks. BTW, these numbers have all been carefully measured by using a practically empty island sim with only 0.1 ms total script time and only 52 Active Scripts in it.
I welcome comments and debate, but mostly hope that the scripters who read this will think carefully about the design of their own scripted objects and the impact they have on busy sims.
---------------------------------------------
FUSHI's SCRIPT TESTING STATS
This notecard contains a detailed list of many popular scripted attachments and their measured lag impact on a sim. Scroll past the introductory bit below if you just want to get to the raw numbers.
*** For those who are interested, however, here's a bit of background about script impact on sim performance ***
There are two stats, visible in the Statistics Window (Ctrl-Shift-1), that are direct measures of the impact of scripted objects on the performance of a sim. "Active Scripts" and "Script Time".
The Active Scripts stat is by far the most important. A sim starts bogging down at 5500-6000 active scripts, regardless of how efficient those scripts might be.
The Script Time stat is also quite important but much more difficult to interpret because of the way sims will throttle back processing time for scripts when other "time" factors increase. Total Frame Time for a sim cannot go much higher than 22.3 ms or the Time Dilation drops below 0.99 and people experience the most common form of "lag" caused by the server, which is Physics FPS dropping far below the Sim FPS and causing extremely slow movement. Total Frame Time comprises things like Images Time (time spent downloading visual data to agents in the sim, which constantly spikes when AVs enter or move around in the sim), Sim Time (time spent calculating physics mostion and collision as AVs or vehicles move around in the sim), and so on. Of all these various "... Time" values that make up the Total Frame time, the sim gives least priority to the Script Time, which is the time spent processing all scripts in the sim. If the Images Time spikes because a new AV just entered the sim, for example, the sim tries to cut down the Script Time accordingly to keep the Total Frame Time as close to the 22.3 ms optimum as possible. However, sometimes the spikes from Images Time (or some of the other "... Time" values) are so high that the sim cannot compensate even by cutting down the Script Time far enough, and the sim experiences a sudden drop in Time Dilation (and it's correspondings Physics FPS) and everyone experiences the most common form of server-side "lag", which is extremely slow "molasses" movement.
In a sim that is not overloaded with AVs and the resulting increases in Agent Time, Images Time, etc., The portion of Total Frame Time that can be allocated to running scripts (Script Time) is usually in the neighborhood of 15 - 19 ms. Now, many fully built-out sims can can have literally between 2500 - 3000 scripted objects in the sim (poseballs, fountains, doors, etc.). About 75% of these objects each have a script time in the range of .003 to .009 ms. The other 25% of these objects will mostly be in the range of .01 to .09 script time, and about a dozen objects will be in the range of 0.1 to 0.3 ms script time. If you do the math (or if LL will finally display total script time on the estate Top Scripts tool, you're looking at a total script time just from scripted objects on the sim that often exceeds this range of available Script Time on the sim. This is why many sims run at more like 0.99 to 0.97 Time Dilation even when there are very few agents on the sim.
The point of all this discourse is that in most sims, especially densely built-out sims with lots of animated objects like Clubs and Playgrounds are already loaded to the max in terms of number of scripts and processing cycles for script.
Now along comes your typical AV, who is usually loaded down with various scripted objects such as AOs, animation HUDs, scanner gadgets, bling jewelry, and quite often weapons or shields of one sort or another. For example, many people enjoy wearing pistol holster(s) or samurai katana sheathes as part of their "look".
The problem, however, is that these AVS are each walking around with anywhere from 100 to 1000 or more Active Scripts in all their various scripted attachments, and due to sloppy coding practices from many popular item builders, these attachments can account for 0.5 to 2.0 ms script time! Think about it... A built-out club type sim is usually already overloaded to the tune of 20-40ms script time of the objects in the sim. Then along comes 20 to 30 AVs to a popular event and they're loaded down with their typical gear that runs at least 100 Active Scripts and 0.5 ms Script Time each! Then they all wonder why their scripts are running so slow, when they have added anywhere from 2000 to 3000 Active Scripts to the sim (remember that hard limit of 6000?) and increased the already saturated Script Time load on the sim by 50% to 75% or more!
********************************************************************** SOME RECOMMENDATIONS
As a general rule, any AV attachment that uses 0.2ms of script time is borderline laggy. If you're wearing more than two of these in a crowded sim (like at a club), you're adversely affecting everyone's enjoyment. Anything that uses more than 0.2 ms is definitely laggy and should be worn/used only when necessary.
As a general rule, try to wear basic "everyday" gear that adds up to no more than roughly 100 active scripts and 0.3 to 0.4 ms of script time. One way you can guesstimate this is by adding up the numbers in following list, which works quite well for calculating your total Active Scripts, but will give you only a fuzzy (and often too high) guesstimate of the total Script Time. A good way to accurately measure your total Script Time is to find an empty island sim that has very low and very stable Script Time. Try to make sure you're the only AV on the island. Watch the Script Time closely to ensure that it's holding at a set value and not jumping around a lot. Now put on all your standard gear and measure the change in Script Time. Take things on and off until you find a combination that is in the club-friendly 0.3 to 0.4 ms range.
*********************************************************************** THE LIST OF SCRIPT SIZES
If there is no ms value shown in the following list, it means the object uses only 0.1 ms of script time or less, so a handful of these objects are generally "safe" to wear all the time without affecting a sim too much.
The first column lists the number of Active Scripts generated by some popular AV attachments. The second column indicates the total milliseconds (ms) of "Script Time" used by those items that are generally considered "too laggy".
Scripts Device Name ------- ----------------------------------------- 1 PersonalTeleportSystem 1 FlipTitle 1 Black Widow Holster 1 Rainbow Sphere 1 Altimeter HUD (Ord.Malaprop) 1 Anti Idle 2 Age Scanner v1.1 2 New Resident Locator 4 Animated Vamp Fangs w/Vampire Lips(Xcite!)v1.5 6 Dragonet 8 Couples MultiAnimator v2d 8 Teleport Effects HUD v1.5.1 9 CSI Combat HUD 9 CSI Inventory HUD 10 Chimera 11 BlogHUD 11 Outland Tech UG01 flare launcher *actual weapon in hand* 12 PsiTEC II (only 0.1ms script time! - note this is NOT the original psiTEC) 15 Wet Ikon Anim Override One.8 16 ZHAO
24 Secret-Agent HUD 3.5d (0.3 ms script time only when the chatspy is deployed; otherwise 0.1 ms) 21 KDC chastity serie collar 1.2.1 24 KDC chastity serie cuffs (L&R) 28 Outland Tech UG01 flare launcher *thigh holster* 24 Abranimations Electromagnetic Plasma Rail Gun v2.0 30 proTEC Shield 31 Outland Tech UG01 wrist com *both parts* (0.2 ms script time) 34 Archatek Dragon Katana (in hand) 36 Auto Emote HUD v1.0.1 36 Hiro Pendragon Colt .45 (0.2 ms script time) 40 Callahan Widowmaker (0.3 ms script time) 44 Multi-Gadget v1.49.3 44 Black Widow (each) active in hand 50 Marlin XCV (0.2 ms script time) 50 Marlin DBV (0.3 ms script time) 54 Archatek Dragon Katana Sheath (0.2 ms script time) 55 aubreTEC Osiris HUD (only HUD) (0.5 ms script time) 54 Orbz Control 6.2.1 (0.3 ms script time) 57 Seburo Compact-eXploder (0.2 ms script time) 66 HUDDLES EZ Animator Deluxe v1.0.4 (0.3 ms script time with AO active; 0.2 with AOs off) 73 Ashes Jin-Geom Katana (in hand) (0.3 ms script time) 79 Musashi Black Rose Katana (in hand) (0.2 ms script time) 87 Archatek Flame Naginata (in hand) (0.3 ms script time) 96 Archatek Flame Naginata Sheath (0.4 ms script time)
110 Outland Tech CFS01 "Jahi" *display-only copy on back* (0.6 ms script time) 138 Outland Tech CFSO1 "Jahi" *actual weapon in hand* (0.6 ms script time) (yes, if both display-only and actual weapon are both worn, the total impact on the sim is 248 active scripts and 1.2 ms script time) 153 Musashi Black Rose Katana Sheath (0.5 ms script time) 179 Ashes Jin-Geom Katana Sheath (0.7 ms script time)
211 aubreTEC Osiris (rezzed with HUD) (1.1 ms script time) 410 psiTEC (1.2 ms script time) (This is the original, not the new psiTEC II which is completely non-laggy)
1036 Souls of the Damned (don't personally own this so haven't measured the exact script time)
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
10-24-2006 11:29
Thanks for the write-up. There is one point I would like to understand better: From: someone The Active Scripts stat is by far the most important. A sim starts bogging down at 5500-6000 active scripts, regardless of how efficient those scripts might be. This is interesting. I remember someone else's tests that demonstrated that the following script: default { state_entry() {} } ... would use up sim cycles. Which is insane, IMO, the scheduler should be able to do a better job that that. But regardless... that seems to tie in with your statement that once you cross 6000 scripts, it's hurting the sim, even if those scripts are idle. I'm thinking about my creation that's in your list, the ZHAO. It has a handful of buttons, and each button has 2 or 3 tiny scripts. I did it that way for modularity. But it looks like re-writing those into one ugly complex script would be less laggy. Ugh. It didn't use to be this way, right? I seem to remember that this changed sometime in the last few releases (1.7 maybe?), when they updated the scheduler, and before that an idle script did not consume resources. I think the new scheduler is a lot better than the old one, since it slows scripts down instead of slowing the sim down. But it looks like it has had the side effect of processing idle scripts, and that's not so good. All IMO, of course. And if I've misunderstood how any of this is working, I'd love to learn more. Thanks, Ziggy
|
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
|
10-24-2006 11:46
Hi Ziggy. I don't remember exactly where I saw LL explicitly admit the 6000 Active Scripts limit, but it was on something concierge-related that I found by accident. I personally see things start to go wonky at around 5500 to 5700 Active Scripts.
As for your ZHAO, I wouldn't worry too much about it, since it falls into or below that 0.1 threshold and has very few active scripts. I wish Keiki could get her HUDDLES EZ Animator down that low when all it's doing is running the AO (which is a mod of your code, I believe), but then her EZ Animator packs a whole lot of functionality into it.
I can't offer any advice re scripting techniques since I only document what developers do and know enough to poke around in the code and take measurements, but I'm no programmer. I'm hoping threads like help to stimulate some discussion and sharing of techniques among the SL scripters, however. ^.^. The grid is certainly not getting any less crowded these days, so every bit of help counts.
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
10-24-2006 13:04
I was under impression a more reliable way to measure overall impact of AV-attached scripts is to have that AV sit on some prim in the sim... the total time taken by their attachments would then show up as time slice utilized by that prim (or by script located in such prim)
can anyone test/confirm/correct that? ^^;;
|
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
|
10-24-2006 14:09
From: Joannah Cramer I was under impression a more reliable way to measure overall impact of AV-attached scripts is to have that AV sit on some prim in the sim... the total time taken by their attachments would then show up as time slice utilized by that prim (or by script located in such prim)
can anyone test/confirm/correct that? ^^;; (Edit) - it seems this technique does work well if you have access to the Estate Top Scripts tool. 1. Create a simple box prim and give it a name that will make it easy to find in the Top Scripts tool. 2. Stick a simple script in it, such as a floating text script. 3. Use the Top Scripts tool to ensure that the script time is nice and low, like .003 ms or some such. 4. Now sit on the prim and refresh the Top Scripts list. Voila! Frankly, I'd never heard of this trick and it's a bit counterintuitive, but hey, that's SL. For those folks who don't have access to the script times in the Estate Top Scripts tool, they still have to do it the old-fashioned way. Darn, though... LOL! Now I'm going to be obsessed with measuring everything on my list again using this technique to get specific script times! Curse you, Joannah! ^.^
|
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
|
10-24-2006 14:23
Joannah's wonderful tip leads to a possibly useful technique for estate managers. Say you have a club with some chairs or couches or poseballs or dance balls around that people routinely sit on. If you create a notecard with the baseline script times of those commonly-sat on objects, with their object names spelled out clearly, then you can get a good idea of the load of any AV in the sim if you find them sitting on one of the objects that you've previously baselined. (Or can entice them to sit on one such object.) Neat trick!
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
10-24-2006 15:30
Part of the problem is that many times, these large numbers of scripts are necessary to work around artificial limits put in by SL.
The most blatant example is that any non-physical object, that wants to move smoothly at less that full speed, has to have 8+ scripts in it in order to take turns doing llSetPos.
If LL are really thinking of going ahead with the "trusted scripters" idea I hope they'll be able to get rid of the enforced delays at some point..
|
Lazarus Wake
Registered User
Join date: 9 Jan 2006
Posts: 33
|
10-24-2006 15:32
So here's a question; how 'absolute' is the total number of scripts running at causing problems?
I ask because in another thread I'm looking for an efficient way to rapidly hide a large number (but not all) the prims in an object. One proposal was to have a large number of small scripts that rely on link messages. They would be idle nearly all the time and would have no listener, but they would still add a significant number of active scripts and according to the original post it seems like that makes such a solution unfeasible.
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
10-24-2006 16:00
From: Lazarus Wake I ask because in another thread I'm looking for an efficient way to rapidly hide a large number (but not all) the prims in an object.
llSetLinkAlpha 
|
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
|
10-24-2006 16:06
From: Yumi Murakami llSetLinkAlpha  Already covered in the other thread that Lazarus Wake mentioned.
|
Lazarus Wake
Registered User
Join date: 9 Jan 2006
Posts: 33
|
10-24-2006 16:09
From: Yumi Murakami llSetLinkAlpha  That's why I mentioned we didn't want to set all the prims transparent.  I think probably I will go use llSetLinkAlpha and a list of prims, but that may cause the parts to vanish sequentially rather than as a block. I'm trying to find another solution that will do a better job vanishing all the prims at once, but without excessive overhead on the sim (such as a large number of scripts might cause).
|
Keiki Lemieux
I make HUDDLES
Join date: 8 Jul 2005
Posts: 1,490
|
10-24-2006 20:00
The next version of my EZ Animator Deluxe will have fewer scripts. I already worked on it, but didn't have enough time to properly test it before I left for my hiatus. I'm hoping to be reconnected and have the upgrade out within 7-10 days.
_____________________
imakehuddles.com/wordpress/
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
10-24-2006 22:34
I was surprised when I found out that the two position tails have a script in EVERY prim.
These new flexi prim tails are much lower lag since they not only only have one script, but they don’t have to send lots of prim updates.
|
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
|
10-24-2006 22:52
From: Keiki Lemieux The next version of my EZ Animator Deluxe will have fewer scripts. I already worked on it, but didn't have enough time to properly test it before I left for my hiatus. I'm hoping to be reconnected and have the upgrade out within 7-10 days. Woot! I love your EZ Animator Deluxe, Keiki. It's the one gadget that I won't do without!
|
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
|
10-24-2006 22:55
as for the my collar and cuffs the main script sink is the on the fly collar label system, since it use llset texture to change font it use for this 15 scripts, wich are, mostly in idle state. most of my color scripts are slowly getting changed to llsetlinkcolor llsetlinkalpha but for texture changes, unless we get, one day llsetlinktexture...
_____________________
 tired of XStreetSL? try those! apez http://tinyurl.com/yfm9d5b metalife http://tinyurl.com/yzm3yvw metaverse exchange http://tinyurl.com/yzh7j4a slapt http://tinyurl.com/yfqah9u
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
10-25-2006 06:09
From: grumble Loudon I was surprised when I found out that the two position tails have a script in EVERY prim.
These new flexi prim tails are much lower lag since they not only only have one script, but they don’t have to send lots of prim updates. Oh, llSetLinkPrimitiveParams, please, please, please 
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
10-25-2006 07:13
From: Yumi Murakami Oh, llSetLinkPrimitiveParams, please, please, please  ::whimper:: And llGetLinkParams too ... that, and arrays. And passing by reference. And... ok ok, it was a nice thought... >>;
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
10-25-2006 10:58
From: Joannah Cramer I was under impression a more reliable way to measure overall impact of AV-attached scripts is to have that AV sit on some prim in the sim... the total time taken by their attachments would then show up as time slice utilized by that prim (or by script located in such prim)
can anyone test/confirm/correct that? ^^;; It does work. However, it doesn't give a full picture of how much time a script is using up. In my experience, the numbers given in the Top Scripts list don't seem to add together to anywhere near the Script Time figure... something's missing. My theory is that the overhead for empty scripts that Ziggy mentioned isn't taken into account in the Top Scripts list. Also, other than avatars sitting on prims, scripts in attachments aren't shown in the Top Scripts list... but I still see a discrepancy between Top Scripts and Script Time when no one in the sim has attachments on.
|
Eddard Keen
Registered User
Join date: 25 Apr 2006
Posts: 2
|
10-25-2006 11:02
So here's a dumb question I'm pretty I know the answer to, just wanted to double check. There's no sort of programmatic access to any of the statistics sited in the original post, correct? So we can't really do any sort of runtime profiling down to any decent level of granularity other than rough estimates of the whole, is that correct?
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
10-25-2006 11:21
This is a pretty useful list and discussion, and I just want to toss in some factoids I've picked up from owning and running a sim. From: Fushichou Mfume The Active Scripts stat is by far the most important. A sim starts bogging down at 5500-6000 active scripts, regardless of how efficient those scripts might be.
In my experience, the sim starts really bogging down at a much lower number of active scripts than this. It's more like 2000-3000, and lots of sims are at or beyond this level. You won't start seeing time dilation until around 6000 scripts, true, but even way lower than that, scripts will be severely delayed and hampered, especially if they're designed to be "realtime" (time-based effects). Example: the automated vehicles in Suffugium start swerving way far on turns at about 2500 scripts in the sim. I wrote these as carefully as I could (although what they're doing is by necessity intensive), and as nearly as I can tell, at about 2500 scripts, they start getting only one or two timer events per second, which is just not enough to correct their course around a corner. From: someone ... If you do the math (or if LL will finally display total script time on the estate Top Scripts tool, you're looking at a total script time just from scripted objects on the sim that often exceeds this range of available Script Time on the sim. This is why many sims run at more like 0.99 to 0.97 Time Dilation even when there are very few agents on the sim.
I don't think that 0.99 to 0.97 dilation is really a problem... I see my sim at 0.99 fairly often, and I have my scripts clamped down enough that Total Frame Time rarely exceeds 18ms per frame. I think 0.99-0.97 script time is simply because the stats are approximate. Anything lower than 0.97 is definitely a problem, though, especially if it's constant, but it takes a heck of a lot of scripts to hit this level. Way before that, you'll see scripts taking on the order of 5-10 seconds to respond to a touch event, because they're all fighting for time, even though the sim's at nearly 1.0 dilation. From: someone [script time rules of thumb, and the list of scripts and script times]
I think it's a really good idea to put the fire under content creators to try to convince them to lower the number of scripts in their products. Quoting script times is a little tricky though... I've noticed a definite difference in script time between sim-servers that my region is running on, so I don't know how valuable it is to compare script times between objects. As an example, when I originally started the thread explaining my discovery that empty scripts take up script time, that was after I'd studied a psitec to see how much script time it was using. It turns out that it was using approximately 10ms on my (class 3, I think?) sim, which is way higher than the 1.2 you saw. I only alluded to it in my thread without calling it out by name, because I knew that Luc was already in progress on version 2 which would have a much lower impact on a sim, and I wanted to be fair. Before that, no one had a clue that dormant scripts took up so many resources. Anyway, it's hard to directly measure script time usage and come up with a good number for how much script time a given object is using. We know (and can easily test) that completely empty scripts such as the one Zippy mentioned earlier will take up a lot of sim resources, so I think maybe it's more to the point to just try to limit the number of scripts on your avatar, period. It'd be difficult to prove this, but my feeling is that almost every script except the most intensive and poorly-coded use more resources simply due to per-script overhead than they do from the actual computation they do. It's not always possible to limit scripts. If you want to change textures or most other properties on a bunch of child prims, you have no choice but to use multiple scripts. There are, though, some pretty nifty/sneaky techniques you can use to lower the number of scripts your creations use, and I'd like to see more discussion of those techniques. You can also lower expectations. Maybe your entire 200-prim wing doesn't need to have every prim go invisible at the same instant. Maybe trying to get smooth movement out of a non-physical object is just too hard on a sim to do. Maybe it's possible to find a creative way around these limits that DOESN'T hurt a sim. Maybe sometimes there's no way around using more scripts. At least by keeping all of the things we know impact a sim in mind, hopefully we can start treating sims better.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
10-25-2006 11:43
From: someone We know (and can easily test) that completely empty scripts such as the one Zippy mentioned Ziggy, por favor. 
|
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
|
10-25-2006 13:45
Lex makes some excellent points in the preceding post. Especially the one about impact being even worse on a Class 3 server compared to a Class 4 server (or the new Class 5s that some lucky--or feted <wink>--island owners will soon have).
What I've been doing since yesterday is re-running all my script tests on the island to which I have Estate Management privs so that I can get specific script times. I'm fairly certain it's a Class 4 server because its in the newest datacenter and was created during the time period that LL was out of spare machines.
So while my numbers would probably be low compared to similar tests run on Class 3 servers, it is important to note that *relative* to each other, the measured times will be proportionally accurate.
I've also noticed that in the Top Scripts tool, *every* script tends to bounce around a certain amount in terms of Script Time shown in the tool. Pick any object and put its exact name in the Filter field and keep clicking the Filter button once every second for about 15 seconds and you'll see a definite variation of time that soon resolves into an obvious range of high and low values. There is also a "settling down" period of roughly 10-15 seconds for some scripted objects when they are first rezzed or equipped. Script time can start out quite high and then shortly settle into its more stable range. Any script that performs periodic scanning (multi-gadget, secret-agent HUD, etc.) also exhibits a lower range for its more "dormant" periods and then a larger spike range for its active scanning periods.
For my testing, I observe each object for about 20 seconds after it has settled down, and I've been recording the *highest* value in the range, because to me that the critical number that ultimately indicates how badly it impacts sim performance. In the case of scanner objects, I record the highest value in the spike range rather than the dormant range.
I'll have these results out today, in a new thread titled "Oct 25 List of Script Sizes and Lag Times"
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
10-25-2006 16:20
The method I use is to go to the beta grid and rez 100's of copys to find out how many it takes to get to some usable number of ms
|