Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sim performance and optimization

Fire Centaur
Creator
Join date: 2 Nov 2006
Posts: 149
02-08-2008 23:13
Hi there,

My name is Fire Centuar, I am the owner of English Village, a language learning sim.

Over the past year, Ive been building and rebuilding, scripting and re-scripting, and now I've hit the question, is my sim operating at its optimal capacity...

What can I do to analyse the performance of my sim. Sure you can do this with the SL client, with the statistics bar, but what do all the numbers mean, and what can I benchmark it against?

Any help would be appreciated.
_____________________
Second Life to your Facebook Profile!
http://www.facebook.com/p.php?api_key=00b8153d7f12a4c7228b6c927fb2c537
Farallon Greyskin
Cranky Seal
Join date: 22 Jan 2006
Posts: 491
02-09-2008 00:24
Script wise, keep your scripts under 15ms total under the "Time(ms)" entry of the stats. The less the better. It wil peak at about 18 ms but then your sim will be sent into time dilation. Some people claim that this does not matter and having 5000 scripts does not lag your sim. As a multiple sim owner I can categorically state that this is UTTERLY FALSE. Besides the ugly fact that all your scripts run slower and slower, the Sims lag/TD start fluctuating wildly as it's trying to juggle more and more script load.

If you can keep the script time down to 5-10ms that give breathing room for your visitors who carry a god awful numer of scripts into the sim with them frequently. (100-200 is /common/ per av)

If you are an estate agent you can see the times of individual scripts from the World->Regeon/Estate->debug->Get Top Scripts. Frequetnly there'll be a couple of REALLY high time scripts you can get rid of or try to fix if they are yours.

Lastly, if you have scripts you put into things like waterfalls for particles, sit targets, or texture animations and that's all the script did, then DISABLE them! They do not need to be "running" after they have set the particle, sit or texture animation property of the object, yes they consume a lot of script time doing "nothing". My sim initially had 50% of the total script time wrapped up in about 800 of these kinds of scripts. I halved my script time when I disabled them all.

BTW the Script IPS number is pretty much totally useless. The total script time number mentioned above is a reliable indicator of how much CPU time you are using and 18ms is the MAX before time dilation (may be less of you have a lot of physical items which take up cpu time themselves)

As for helping with client lag:

Try not to over do the textures (Now that the sims cache textures this helps with sim lag as well), keep them as small as neecessary for every object, don't use 512x512 for everything.

Transparent textures cause the client to run slower that non-transparent so the less you can get away with using them the better (They are like 2x as time expensive? just a guess from my own experience).

Don't over use floppies. Tons of plants all come floppy nowadays and I've been to areas where the frame rate goes slide show because there are like 1000 floppies in sight. (Heh and if you buy plants, look into them for scripts that set the phantom property and stay running, another big source of useless sim lag)
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
02-09-2008 10:14
Thanks Farallon for your explanation and tips. I have two questions though on disabling scripts.

This means that, if I have a waterfall with particles, I must uncheck the 'Running' checkbox and the particles will still be there? Also after resetting the sim? And is this the same for for example a particles script with fire flames or butterflies or whatever?

And about sit targets: in my furniture I have regular poseballs. I don't think you mean this with 'sit targets'. But how about those poseballs? That script is only 'running' when someone uses the poseballs, right? Do regular poseballs cause lag?

Oh and one other thing: what are 'floppies'? :)
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
02-09-2008 10:55
From: Farallon Greyskin
Script wise, keep your scripts under 15ms total under the "Time(ms)" entry of the stats.

/me does not argue that scripts can't lag sims - that's just silly, IMO.

The quote above doesn't look right to me, though. Sims want to run at 45fps - a sim running at 45fps is a happy sim and you won't ever see a higher sim fps. Some easy math on that shows that a sim can't spend more than about 22ms on each frame and still be happy.

The way the sim allocates script time, unless I'm totally wrong, is that it does all it's 'other' stuff - moving stuff around, getting textures from the asset server and sending it to people, etc, etc - then gives the rest of the 22ms to scripts. I think the Script Performance stat, which I don't totally understand, is a better indication of how expensive scripts are..

Of course, if you're an estate manager, you get access to Top Scripts. This is probably the place to look if you're looking to reduce script lag. Watch the numbers for a bit and take look at your most expensive scripts. You may be able to make some of the more expensive a little friendlier.

From: Paulo Dielli
This means that, if I have a waterfall with particles, I must uncheck the 'Running' checkbox and the particles will still be there? Also after resetting the sim?

Particles are a property of a prim - once the particles are going the way you want, you can delete the script from the object and the particles will keep going, even after a sim restart.

The exception to this is objects that change the way the particles look. Like, if you have a flame that sometimes changes to a bigger flame or burns green or whatever, that can only be done with a script. If it doesn't change, you don't need to keep the script.

For poseballs, I don't think they cause lag in and of themselves - the most expensive part of them is that most have scripts that listen on the same chat channel for show/hide commands. I don't think that's a huge cost and there's not a lot you can really do about it anyway.
Farallon Greyskin
Cranky Seal
Join date: 22 Jan 2006
Posts: 491
02-10-2008 17:18
Yes turn off the scripts using the "Running" check box in the editor OR select the object or objects and then go to "Tools"->"Set scripts to not running" this can sometimes turn off scripts in objects you own (sometimes not).

The particles, texture animation and sit target are all permanent properties of the prim just like size and color. So no they will never be reset or stop working through a sim restart UNLESS LL really screws something up bad during a software uptgrade or something (has happened rarely in the past).

Sit target is used just to position a person ON a prim It is used n poseballs but pose balls generaly do a lot more and those scripts have to run. But frequently you might want to put a simepl sit target n a bar stool with no fancy animation or pose and you do that with a script but then delete or remove the script after it is run once.

And my "18ms" for scripts I got simply through experience of looking at those numbers. You are right that the sim requires 22.5 ms or less processing time to maintain a time dialation of 1.0. But the other 4.5ms are something of a constant that are used up by all the other things the sim does (Assumeing you don;t have some big physics using device on the sime taking up extra physics time). Though.. as LL has piled more and more work on to the sims that is not showing up in those Time(ms) numbers, I'm finding that anything over 15ms of script time (with the normal load no the other numbers) is starting to cause time dilation.

Like I get small spikes of 0.99 TD constantly when my sims are running with a total frame time of 18.5 ms these days :( Makes me sad...
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
02-10-2008 20:14
Thanks Sindy and Farallon. This is great advice. I'm sure many sim owners will know these tricks by now, but I've never read them somewhere except in this thread. Thanks a lot!
Fire Centaur
Creator
Join date: 2 Nov 2006
Posts: 149
thanks!!
02-11-2008 01:14
Thanks so much Farallon for the detailed answer!!! I really appreciate it! thanks!
_____________________
Second Life to your Facebook Profile!
http://www.facebook.com/p.php?api_key=00b8153d7f12a4c7228b6c927fb2c537
AWM Mars
Scarey Dude :¬)
Join date: 10 Apr 2004
Posts: 3,398
02-11-2008 08:09
Press Ctrl+Shift+1 then at the botton of that HUD click the Time (ms) word, that drops down another table which shows timings for various elements including script timings. Press same key combination to clear..

Press Ctrl+Shift+9 that gives you a whole nested graph set of what the client and sim timings are, you can drill down (assuming enough screen real estate) and look deeper into the reports.

In theory, a class 5 sim will support around 5,000 active scripts. I have been on some sims that were running over 9,000 and it was as laggy as hell.. that was back in the days of Class 3 sims lol.

Oh, in case you don't know, sculpties have a refresh rate of around 12-15 fps, which unless you render your movies in sync with that refresh rate, will add to the client loadings by 100%. I found this out when I couldn't figure out why our movies doubled the loading on the client pipelines in some sims that others, until we narrowed that down to those sims that had one thing in common, sculpties, reading from the client loading showed us that they were refreshing at a rate of between 12-15fps. We re-rendered out movies at a different framerate that syncronised with the sculpties and the loadings halved.
_____________________
*** Politeness is priceless when received, cost nothing to own or give, yet many cannot afford -

Why do you only see typo's AFTER you have clicked submit? **
http://www.wba-advertising.com
http://www.nex-core-mm.com
http://www.eml-entertainments.com
http://www.v-innovate.com