User:Babbage Linden/Office Hours/2009 02 04

From Second Life Wiki
Jump to: navigation, search

Transcript of Babbage Linden's office hours:

[8:03] WolfPup Lowenhar: morning babbage

[8:03] Arawn Spitteler: It's rather quiet; is Babbage not here? Just arrivee?

[8:03] Nock Forager: Hi Babbage

[8:03] Babbage Linden: morning all

[8:03] Babbage Linden: (or afternoon)

[8:03] Imaze Rhiano: good day

[8:03] Fake Fitzgerald: hi Babbage!

[8:03] Babbage Linden: let me ping the groups

[8:03] Fake Fitzgerald: midnight here :)

[8:04] Imaze Rhiano is cooking some food for family. same time....

[8:04] Arawn Spitteler imagines a fake oasis: Midnight at the Oa-sis... Send your camel to beh-hed...

[8:05] Babbage Linden: let's give people a couple of minutes to arrive

[8:06] Alexcalle Skall: Hello

[8:06] WolfPup Lowenhar: hope your office hour dose not get hit with a restart like CG's did yesterday

[8:07] Babbage Linden: ok, so, we've been doing quite a lot of work on mono this week

[8:07] Babbage Linden: looking in to the scheduler problems with 1.25

[8:07] Babbage Linden: there were 2 related problems

[8:08] Babbage Linden: first, it was possible in some circumstances for scripts to cause high time dilation, due to not yielding correctly

[8:08] Babbage Linden: second, we found that the memory accounting was coupled to the scheduler, so when we changed the scheduler to fix the first problem, some scripts started having stack/heap collisions

[8:08] Babbage Linden: i've just submitted a QAR for a new branch that should fix both problems

[8:09] Babbage Linden: it decouples scheduling and memory accounting

[8:09] Babbage Linden: and fixes the scheduler to make scripts yield correctly

[8:09] Babbage Linden: because both changes can have adverse effects on scripts, we're planning to release these changes as a beta server

[8:10] Babbage Linden: and allow you to test your scripts on aditi before we deploy the changes on the main grid

[8:10] Babbage Linden: in particular, if your script comes close to exhausting memory, you should test it in the beta

[8:10] Alexcalle Skall: but it is like an opensim? Or will be a client version?

[8:10] Babbage Linden: as it may have been getting away with briefly using more memory than it was entitled to

[8:11] Babbage Linden: and if your script is heavily reliant on slow script calls

[8:11] Babbage Linden: like list manipulation or sorting

[8:11] Myla Moody: this is for mono compiled scripts only, or lso as well?

[8:11] Babbage Linden: you should test your scripts on the beta

[8:11] Babbage Linden: the changes only affect mono scripts

[8:11] Babbage Linden: and will only affect a small percentage of scripts

[8:11] Myla Moody: thank you

[8:12] Babbage Linden: we'd like to get a feel for how many scripts this affects

[8:12] Babbage Linden: so, if you test scripts that use a lot of memory or slow functions and they work fine

[8:12] Babbage Linden: let us know, as well as if you have problems

[8:12] Babbage Linden: periapse will be organising the beta and communication

[8:13] Babbage Linden: so, he'll be working out how to collect and analyse feedback

[8:13] Babbage Linden: the changes still need to go through the QAR process

[8:14] Babbage Linden: but if that goes well, some regions with the changes should be available on the beta grid in a couple of weeks

[8:14] Babbage Linden: in the meantime we've reverted the scheduler changes we made in 1.25.4, so scripts should be running as normal on 1.25.5

[8:15] Babbage Linden: have any of you had any problems with memory or performance of mono scripts in 1.25.4?

[8:15] WolfPup Lowenhar: i have not

[8:15] Cale Flanagan: my greeter script greeted ne with stack overflow, so yes:)

[8:16] WolfPup Lowenhar: and i have some vendor the use database and emailing scripts out wuith not problems in them that i can tell

[8:16] Alexcalle Skall: Normally I use mono but my scripts are very light memory.

[8:16] Babbage Linden: so, those problems should be resolved in 1.25.5

[8:16] Alexcalle Skall: So i can't test it

[8:16] Cale Flanagan: would be an idea if list fuction could work on sourcelist and dont need a temporary list to hold data i throw away

[8:16] Babbage Linden: and i encourage you to test them in the beta once it's availabe

[8:17] Babbage Linden: there are lots of improvements we could make to the list processing functions

[8:17] WolfPup Lowenhar: alexcalle you can see an improvement in generaly script performance if your convert them to mono

[8:17] Alexcalle Skall: Yuuuuuuuus!

[8:17] Babbage Linden: one big reason that they're slow is that we need to convert them from mono arrays to LSL lists when we pass them to library functions

[8:18] Babbage Linden: but, as many of the functions don't need access to the sim internals, we could instead operate on the mono arrays directly

[8:18] Babbage Linden: this would be a particularly big win for functions that are used to treat lists as arrays anyway

[8:19] Babbage Linden: the reason we haven't done that so far is that we'd end up with 2 implementations of the library functions to maintain

[8:19] Cale Flanagan: would be great:) otherwise i would ask for writing my own memorycode in c:)

[8:19] Babbage Linden: the LSL implementation

[8:19] WolfPup Lowenhar: that would be nice if could get mult dementional ararys going in mono

[8:19] Babbage Linden: and the mono implementation

[8:19] Babbage Linden: so, if we can get away with using a single implementation we will

[8:20] Cale Flanagan: convert them for lso use...

[8:20] Babbage Linden: even with the copying between mono and C++ the list functions are still faster than when called from LSO

[8:21] Babbage Linden: the reason that list manipulation ends up using a lot of memory is that LSL has value semantics

[8:22] Babbage Linden: so, when you execute an expression like l = somefunc(l) there are 2 copies of l in existence until the final assignment

[8:22] Babbage Linden: it was in these kind of instances that mono allowed scripts to briefly use too much memory

[8:23] Babbage Linden: so if you use those kind of expressions in your scripts you should definitely test them in the upcoming beta

[8:24] Babbage Linden: also, you should avoid using the l = (l=[]) + l + new_item syntax when using mono

[8:24] WolfPup Lowenhar: ok will havce to take one of my fossl vendors to the beta then

[8:24] Arawn Spitteler doesn't see why there'd be two values of l, if l is simply the final storage bucket, for the new value. it would be the assignment operator and the somefunc that would be using memory.

[8:24] Babbage Linden: although it's more memory efficient with LSL, it's worse with mono

[8:25] Hidenori Glushenko: worse?

[8:26] Babbage Linden: the list assignments allocate new lists

[8:26] Babbage Linden: so l = (l=[]) + l + item

[8:26] Babbage Linden: creates a new mono array for []

[8:26] Babbage Linden: which allocates some memory

[8:27] Babbage Linden: if you just did l += item

[8:27] Babbage Linden: the allocation would be avoided

[8:27] Babbage Linden: once the final assignment has finished, then the memory will be reclaimed

[8:27] Babbage Linden: but the extra complicated expression requires more memory while executing

[8:28] Hidenori Glushenko: I understand, thanks babbage.

[8:28] Babbage Linden: the way memory accounting works with mono is that we measure the size of the script when it's not running

[8:28] Babbage Linden: and add the size of the bytecode

[8:28] Babbage Linden: the minimum size of a mono script is 4K

[8:28] Babbage Linden: so, when you start running, you have 60K available

[8:29] Arawn Spitteler: "Start Running," means an event is called?

[8:29] Babbage Linden: during your time slice you might allocate 2K of memory, but end up only referencing 1K at the end of your time slice

[8:30] Babbage Linden: so, at the end of the time slice, the memory accounter will determine you have 59KB available

[8:30] Babbage Linden: but while you're running the sim thinks you might only have 58K free

[8:30] Babbage Linden: as you get close to using up all your memory, this difference matters

[8:31] Babbage Linden: it can mean the difference between a running script and a stack heap collision

[8:31] Babbage Linden: so, when writing scripts in mono, you should avoid creating temporary variables if you can

[8:33] Babbage Linden: does that make sense?

[8:33] WolfPup Lowenhar: i know i try to have all myne global to start with

[8:33] Babbage Linden: good

[8:34] Babbage Linden: actually, it's only lists and strings you need to be careful about as they use heap memory

[8:34] Babbage Linden: all other types use stack memory

[8:34] Arawn Spitteler was doing some thing convoluted, the other day: something = llList2Rot(llGetObjectDetails(llGetLinkKey(2), [OBJECT_ROT]),0 or something like that. Should that be broken, or compiled with other expressions?

[8:35] Babbage Linden: so, using local rotations, vectors and integers won't impact memory usage

[8:35] WolfPup Lowenhar: sometimes it can be dificult though when your having to convert one that was orginaly written in LSL to mono though when you did not make the orginal

[8:35] Babbage Linden: but lists, strings and keys (which are implemented as strings) should be avoided where possible

[8:35] Babbage Linden: WolfPup, yes

[8:36] Babbage Linden: but all LSL scripts should have enough memory when converted to mono

[8:36] Babbage Linden: (the opposite isn't true)

[8:36] Babbage Linden: if you start changing a script that used to be LSL and start running out of memory

[8:37] Babbage Linden: look for temporary lists, strings and keys that you can remove

[8:37] Babbage Linden: especially the l = (l=[]) + l + item construction

[8:37] Babbage Linden: ok, unfortunately i've got to run off to help another linden

[8:37] WolfPup Lowenhar: would it be better to make them global(putting them at the start of the script)

[8:37] Babbage Linden: so i'm going to have to cut our meeting short today

[8:38] Babbage Linden: but i hope that's been useful

[8:38] Cale Flanagan: without + item is was very usefull to get again old memory usage...

[8:38] Babbage Linden: and that you'll be able to test your scripts on the beta grid soon

[8:38] Babbage Linden: thanks for coming everyone

[8:38] Mystical Cookie: thank you for your time :)

[8:38] Babbage Linden: hope to see you next time

[8:38] WolfPup Lowenhar: Thank Youuuuuu!! for the tip for having us here babbage

[8:38] Fake Fitzgerald: thanks Babbage

[8:38] Nock Forager: thanks babbage.

[8:39] WolfPup Lowenhar: dang hosting gesture :)

[8:39] Babbage Linden: bye!

[8:39] WolfPup Lowenhar: babbag i have one question can an email script in the beta grid comunicate with a 'server' on the main grid?

[8:40] Arawn Spitteler: We shold be ble to; shouldn't we?

[8:40] Myla Moody: i would be surprised if the uuid mappings cross grids, but would be fun to test :)