Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Oct 25 List of Script Sizes and Lag Times

Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
10-25-2006 14:58
FUSHI's SCRIPT TESTING STATS - Oct 25, 2006

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 will be close to the mark if you're on one of the newer "Class 4" sims, but be aware that the script time values will be even larger on older "Class 3" mainland sims.


***********************************************************************
THE LIST OF SCRIPT SIZES

The first column lists the number of Active Scripts generated by some popular AV attachments (and some vehicles). The second column indicates the total milliseconds (ms) of "Script Time" used by each item. The measurements were taken on a Class 4 island; times for Class 3 sims will be correspondingly higher. The listed measurements are the highest value of the observed steady range over a 20- to 30-second period. In the case of scanner gadgets, the listed measurement is the highest value of the "spike" range when the gadget in kicking off a new scanning cycle.

CODE

Active Script
Scripts Time (ms) Device Name
------- --------- -----------------------------------------
1 .004 PersonalTeleportSystem
1 .004 FlipTitle
1 .004 Black Widow Holster
1 .008 Rainbow Sphere
1 .103 Altimeter HUD (Ord.Malaprop)
1 .003 Anti Idle
2 .102 Age Scanner v1.2
2 .081 New Resident Locator
4 .014 Animated Vamp Fangs w/Vampire Lips(Xcite!)v1.5
6 .110 Dragonet
8 .030 Couples MultiAnimator v2d
8 .031 Teleport Effects HUD v1.5.1
9 .038 CSI Combat HUD
9 .054 CSI Inventory HUD
10 .036 Chimera
11 .043 BlogHUD
11 .069 Outland Tech UG01 flare launcher *actual weapon in hand*
12 .041 PsiTEC II (note this is NOT the original psiTEC)
15 .181 Wet Ikon Anim Override One.8
16 .063 ZHAO

24 .405 Secret-Agent HUD 3.5d (.593 with chatspy active)
21 .082 KDC chastity serie collar 1.2.1
24 .103 KDC chastity serie cuffs ( both L&R equipped)
28 .123 Outland Tech UG01 flare launcher *thigh holster*
24 .082 Abranimations Electromagnetic Plasma Rail Gun v2.0
30 .126 proTEC Shield (.157 when a-linked to psiTEC II)
31 .430 Outland Tech UG01 wrist com (both parts equipped)
34 .143 Archatek Dragon Katana (in hand)
36 .151 Auto Emote HUD v1.0.1
36 .125 Hiro Pendragon Colt .45
40 .793 Callahan Widowmaker (powered up)
44 .393 Multi-Gadget v1.49.3
44 .267 Black Widow (each) active in hand with HUD equipped
50 .551 Marlin XCV (powered up)
50 .741 Marlin DBV (0.3 ms script time)

54 .201 Archatek Dragon Katana Sheath
55 1.027 aubreTEC Osiris HUD (only the HUD)
54 .190 Orbz Control 6.2.1
57 .236 Seburo Compact-eXploder
66 .317 HUDDLES EZ Animator Deluxe v1.0.4 (.207 with AOs off)
73 .235 Ashes Jin-Geom Katana (in hand)
79 .291 Musashi Black Rose Katana (in hand)
87 .290 Archatek Flame Naginata (in hand)
96 .525 Archatek Flame Naginata Sheath

110 .354 Outland Tech CFS01 "Jahi" (display-only copy on back)
138 .493 Outland Tech CFSO1 "Jahi" (actual weapon in hand)
(if both display-only and actual weapon are both
worn, the total impact on the sim is 248 active
scripts and .803 ms script time)
153 .471 Musashi Black Rose Katana Sheath
179 .586 Ashes Jin-Geom Katana Sheath

211 1.833 aubreTEC Osiris (powered up w/HUD worn toos)

1036 -no measurement - Souls of the Damned
(I don't own this but once had a friend check the script
size for me)
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
10-25-2006 21:56
One thing I forgot in my original post: In other related threads, Keiki Lemieux and the CS:I devs have stated that they're planning to release newer, more efficient versions of their products relatively soon. So don't put too much stock in the stats currently listed for the HUDDLES EZ Animator Deluxe or for any of the CS:I katanas and spears.

I personally look forward to improvements in these products because the EZ Animator is a standard gadget that I wear 98% of the time, and its current size is partly what keeps me from wearing some other things I'd like to wear full time. And I love walking around with an equipped katana sheath, but just can't do it right now in good conscience.
Aakanaar LaSalle
Registered User
Join date: 1 Sep 2006
Posts: 132
10-25-2006 22:55
I've got a question.

I've read in a couple posts now, about how the katana's in their sheaths are for looks only.. so why do they need scripts at all? animation overriders?

It would seem to me that if it's for looks only, it should just be a few prims attached to the back.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
10-26-2006 01:59
A lot of katanas in their sheaths are the sheathed part of a two part system... there is also a katana in the hand. Even if only for looks (the C:SI ones also do combat) the sheath and drawn katana talk to each other so the drawn one will appear when told to do so, along with playing a "drawing blade" anim, and disappear when told to, along with a sheathing blade anim.

Katanas shouldn't be on the back... not usually. Hip as part of the daisho surely?
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
10-26-2006 07:27
One pattern that should be noted, I think: for reasons of style and realism, it's common for many weapons to have a holstered or sheathed version (the "style" part), and you usually click on the holster/sheath to draw the weapon itself, whereupon the holster/sheath appearance changes to no longer display the weapon in the holster/sheath, but only the holster/sheath itself (the "realism" part).

This is a desireable behavior from the user's point of view, but in most cases it seems to incur nearly double the sim impact of a weapon alone. The Outland Tech weapons do this. The Combat: Samurai Island (C:SI) weapons do this. The only weapon I own and have tested that does not do this is the Black Widow. Until I saw the Black Widow for myself, I just assumed that holstered/sheathed weapons had no choice but to incur this double overhead.

My point being that if one person has figured out how to make a holster-weapon system that performs all the desired functionality, but where the holster itself incurs an overhead of only 1 active script and only .004 ms script time, then it should be possible (and *desireable*) for all the other weapon makers to follow suit. Far too many people enjoy wearing their weapon holsters/sheathes as part of their "look" (vamps, ganstas, paramilitaries, some furrys, etc.). Yet most of these people have no clue how much they're hurting the performance of every sim they visit, particularly their favorite hangout sim.

To me, the onus falls onto the weapon developers to learn (share?) how to make more efficient, sim-friendly holsters/sheathes.
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
10-26-2006 08:17
From: Fushichou Mfume
To me, the onus falls onto the weapon developers to learn (share?) how to make more efficient, sim-friendly holsters/sheathes.

Well, the weapon rezzing scripts are quite trivial on the basic level
CODE

// weapon script. item should be made phantom and optionally 100% transparent
integer attach_spot;

default {

on_rez( integer Parameter ) {

attach_spot = Parameter;
if( attach_spot ) { llRequestPermissions( llGetOwner(), PERMISSION_ATTACH ); }
}

run_time_permissions( integer Permissions ) {

llAttachToAvatar( attach_spot );
llSetAlpha( 1.0, ALL_SIDES ); // custom routine for more complicated item
}

attach( key Contact ) {

if( Contact == NULL_KEY ) {

// optional, send signal to display weapon in the holster again, then....
llDie();
}
}
}

// holster script
default {

touch_start(integer Contacts) {

if( llDetectedKey(0) != llGetOwner() ) return;

llRezObject( "weapon", llGetRootPosition(), ZERO_VECTOR, ZERO_ROTATION, ATTACH_RHAND );
// hide holstered weapon here
}
}

but that said, not sure if rezzing (often 100+ prims large) items at whim is more sim-friendly than having them permanently attached to AV and set to 100% transparent... someone would need to test that.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
10-26-2006 10:19
Rezzing objects is anti-social on the sim. Things like helterskelters that rez a few physical balls and let them slide down a ramp... well just the rezzing part is quite nasty.

Larger objects seem to be a bit more anti-social, objects with more scripts and more textures are also more anti-social - suddenly clients need to be told and textures rezzed, scripts start running and so on... and although part of that hit is on the client, a fair amount of it is on the sim.

Constantly on but alphad out... My guess is that everyone that ever sees it loads the textures so its not just a scripting issue, but it's probably more general load over time. It's a hard call, but I have to say I'd do the alphaing approach if I made such things. General load grade load we can all cope with (if we must), sudden heavy load affects me more adversely (like making me swear at the computer) but that might be a personal thing.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Fushichou Mfume
Registered User
Join date: 30 Jul 2005
Posts: 182
10-26-2006 10:50
From: Eloise Pasteur

Constantly on but alphad out... My guess is that everyone that ever sees it loads the textures so its not just a scripting issue, but it's probably more general load over time. It's a hard call, but I have to say I'd do the alphaing approach if I made such things. General load grade load we can all cope with (if we must), sudden heavy load affects me more adversely (like making me swear at the computer) but that might be a personal thing.


Keeping a heavily scripted object (your typical weapon) equipped but invisible is definitely far more overall load on the sim than an heavily scripted object that does not exist at all until it is rezzed for use. That's where I think Luc Aubret is totally on the mark for his handling of the Black Widows and where everyone else using transparent weapons is incurring too much overhead.

Sure there's a short spike in the sim load when you rez an object, but I'd rather deal with one short spike than constant load on the sim. We all deal with major spikes anyway, when any new AV enters. If that AV is wearing fewer objects and fewers scripts, then its certainly less impact than if they're loaded up with script-heavy invisible attachments that are idle 95% of the time.

Now granted, this rez on demand approach won't work well for things like the C:SI katanas, because part of their "realism" is the drawing from sheath animation with the visual "blade trails". They couldn't do that if they rezzed on demand. At least not easily ;-). I suppose they could do one anim to reach for the sheath, hold it while they rez the katana, and then after fully rezzed and the katana script says "I'm here now" they could trigger the second "draw" animation.
Lazarus Wake
Registered User
Join date: 9 Jan 2006
Posts: 33
10-26-2006 10:56
From: Fushichou Mfume
...
To me, the onus falls onto the weapon developers to learn (share?) how to make more efficient, sim-friendly holsters/sheathes.


I started up a thread for ideas about how to do that after the Oct 23 list of items and scripts.

/54/e8/145252/1.html
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
10-26-2006 12:12
From: Fushichou Mfume
Keeping a heavily scripted object (your typical weapon) equipped but invisible is definitely far more overall load on the sim than an heavily scripted object that does not exist at all until it is rezzed for use. That's where I think Luc Aubret is totally on the mark for his handling of the Black Widows and where everyone else using transparent weapons is incurring too much overhead.

Sure there's a short spike in the sim load when you rez an object, but I'd rather deal with one short spike than constant load on the sim.

How about third option -- no rezzing and llSetScriptState() to keep the idle weapons literally idle? ^^;;
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
10-26-2006 12:41
From: Joannah Cramer
How about third option -- no rezzing and llSetScriptState() to keep the idle weapons literally idle? ^^;;


Well, if there were a remote wake trigger or some other way to wake a script, that would totally rock.
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
10-26-2006 12:50
Well, if there were a remote wake trigger or some other way to wake a script, that would totally rock.One active script, awaiting instructions to reactivate the other scripts, can use llSetScriptState() to turn the other scripts back on. Provided it does not turn itself off, the same script that turns them off can turn them back on. Alas, there is a same-prim [not same object] limitation in llSetScriptState().
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
10-26-2006 12:55
From: RobbyRacoon Olmstead
Well, if there were a remote wake trigger or some other way to wake a script, that would totally rock.

You can have controller script doing the work.. so that's one small script of overhead, but possible large savings, i'd guess.
CODE

set_scripts( integer State ) {

integer idx; integer count = llGetInventoryNumber( INVENTORY_SCRIPT );
string self = llGetScriptName();
for( idx = 0; idx < count; ++idx ) {

string name = llGetInventoryName( INVENTORY_SCRIPT, idx );
if( name != self ) { llSetScriptState( name, State ); }
}
}

default {

state_entry() { set_scripts( FALSE ); }

touch_start( integer Contact ) { state active; }
}

state active {

state_entry() { set_scripts( TRUE ); }

touch_start( integer Contact ) { state default; }
}
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
10-26-2006 13:33
I'd not thought of llSetScriptState, I don't play with multi script things that toggle often enough.

But... I'd have approached it with two state scripts, the "off" mode just has a link message event to go active, the active mode does all the heavy stuff. Even with scores of scripts, just waitnig for a link message it's not that dire and thus we're looking at low continuous resource drain vs. a big spike. llSetScriptState sounds even better though.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Lazarus Wake
Registered User
Join date: 9 Jan 2006
Posts: 33
10-26-2006 13:59
From: Joannah Cramer
How about third option -- no rezzing and llSetScriptState() to keep the idle weapons literally idle? ^^;;

As I see it that isn't going to have much of an effect if the scripts are written efficiently to begin with.

As other people have pointed out the script calling llSetScriptState() needs to be in the same prim as the script being turned on or off. If you code efficiently you should probably only have a single script in a prim so as to reduce the number of active scripts running. This means that all you've accomplished is to take one idle script and replaced it with another.

The size of an idle script doesn't really have anything to do with the load it puts on the server. There may be some other factors a script has that do impact the load, such as the number of active llListens, but those could be turned off while the script is idle.

In fact if anything you've actually caused slightly more load on the server since each controlling script will be assigned 16k of memory and I do not believe that the deactivated script will release its own 16k of memory.

Of course if it were possible for one script to turn on or off all the other scripts in an object through a command like a hypothetical llSetLinkScriptState (ALL_PRIMS) then it would be a good idea.
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
10-26-2006 15:38
From: Lazarus Wake
As I see it that isn't going to have much of an effect if the scripts are written efficiently to begin with. (..)

If you code efficiently you should probably only have a single script in a prim so as to reduce the number of active scripts running.

Well, the table in opening post shows that a number of active scripts in regular items can exceed 1 by quite an amount. Given the memory limits and then all the work-arounds one would want/have to utilize working with the single timer etc ... the '1 script' thing is more of ideal than absolute proof of efficiency imo, especially when some systems go for modular, easily expandable approach and wide range of features, which can be quite in conflict with the "all in one script" concept.
Lazarus Wake
Registered User
Join date: 9 Jan 2006
Posts: 33
10-26-2006 16:12
Sorry. I was talking about one script per prim. What the table shows is multiple scripts per object, which is neccessary sometimes since certain commands can only be executed on the prim containing the script.

Of course there are reasons why someone might have multiple scripts in the same prim other than sloppy coding, but my guess is an awful lot of the extra scripts are because different prims 'need' their own scripts.
Foo Spark
alias Bathsheba Dorn
Join date: 8 Nov 2006
Posts: 110
12-22-2006 01:37
From: Fushichou Mfume
One thing I forgot in my original post: In other related threads, Keiki Lemieux and the CS:I devs have stated that they're planning to release newer, more efficient versions of their products relatively soon. So don't put too much stock in the stats currently listed for the HUDDLES EZ Animator Deluxe or for any of the CS:I katanas and spears.


I know it's a late bump, but I just saw this thread...I'd like to put that list on a notecard and put it on a card giver in the landing area of my land. (With the above caveat of course.)

Not that it would matter much, as my land is tiny and not many people visit, but I'd like to spread the word where I can. So often I see people, not newbies, come into the sim and watch the script count jump 300, and it's plain they have no idea...plainly you put a lot of work into those tests, and the results should be known to more than the small group of forum fanatics.

Would you be open to that use? Should I put your name on it?

Thanks.