Page 2 of 3

Re: Lower lag

Posted: Sun Feb 27, 2011 3:34 pm
by Wellington Beam
I've not found any conclusive studies on the relative merits of lsl and mono but as far as I'm aware the inworld tools for reporting mono memory usage still report the maximum amount of memory it can use and not what it's actually using. That is unless LL have implemented better script usage tools since last March and I missed the announcement.

A maximum of 64KB is allocated for each script but the average mono script uses 9KB and some would be less. I imagine it's similar to how memory allocation works in Linux. The kernel will keep on assigning memory until all the physical memory is allocated and a reporting system might show the server's run out but in reality it hasn't. If a new process needs memory and existing processes are allocated the total available memory but not using it all then the kernel will free some up for the new process.

https://blogs.secondlife.com/community/ ... ipt-limits
http://wiki.secondlife.com/wiki/Mono

Still be interesting to see some real comparisons though.

Re: Lower lag

Posted: Mon Feb 28, 2011 1:28 pm
by LindaB Helendale
I talked with Becky Pippen who knows things, and even though Mono uses dynamic memory allocation, and average mono script is much smaller than LSL, Lindens apparently had some problems moving the variable size virtual machines across sim borders and it's likely all Mono scripts are actually reserved 64 kB in the server (contrary to all the wiki pages).

So to save memory, LSL would be preferred, for small scripts.
To reduce lag, LSL may help if the sim server is swapping (and 5% of servers are according to babbage linden) and if converting the scripts to LSL would end that swapping, but LSL is so much slower it's more likely that LSL adds lag.

Re: Lower lag

Posted: Tue Mar 01, 2011 8:24 am
by PeaceSmythe
I honestly wonder how this is going to interact with personal script limits.

Peace

Re: Lower lag

Posted: Tue Mar 01, 2011 11:31 am
by Janet Rossini
I don't think I understand the wonder. Reducing region script usage will surely help reduce overall lag for the same level of personal scripts, but that seems so obvious that it must not be what you're wondering about.

Tell us more about this wondering ...

Re: Lower lag

Posted: Tue Mar 01, 2011 12:29 pm
by Wellington Beam
As I understand it there will be separate limits for avatar, parcels and regions. As far as managing NCI's script usage goes we can only really look at parcel scripts.
http://wiki.secondlife.com/wiki/User:Be ... Limits_FAQ

If we need somewhere to test and compare scripts then DS would be best since we have estate powers and testing can be done without affecting other land owners. When I've looked at the top scripts I paid more attention to script time than memory usage but you can't do that on mainland yet.

Re: Lower lag

Posted: Tue Mar 01, 2011 1:00 pm
by Janet Rossini
are estate powers in DS available to us all, or must we do something or be blessed in order to use them?

thanks,

Re: Lower lag

Posted: Tue Mar 01, 2011 2:38 pm
by PeaceSmythe
What I was referring to was the memory useage of Mono vs LSL compiled scripts. Will all mono scripts start at 64k? If things are so uncertian, how do we achieve a reasonable assesment of memory useage? I'm asking this more rhetorically atm.

Peace

Re: Lower lag

Posted: Wed Mar 02, 2011 6:09 pm
by fr43k Paine
Beverly Montgomery wrote:...and fr43k didn't you know that some scripts still work even after being removed. hehehe just a reminder there. :D
I did know that, Bev. One question was, if we could use that to our advantage.
LindaB Helendale wrote:...it's likely all Mono scripts are actually reserved 64 kB in the server (contrary to all the wiki pages).
Yes, I heared a dozens of misc. scripters saying the same. That's why I suggested to have someone in the team, who knows a lot about the server software that LL is using, as IDK how the (different) server software handles the memory stuff. If it works like under Linux, as Welli mentioned, there might be no reason to do all that work.
LindaB Helendale wrote:... but LSL is so much slower it's more likely that LSL adds lag.
Does that mean, that LSL uses less memory but causes a higher CPU-load?

Re: Lower lag

Posted: Wed Mar 02, 2011 10:18 pm
by Imnotgoing Sideways
This is where I've gotten my information on Mono. (^_^)
http://wiki.secondlife.com/wiki/Mono
Has the available memory for scripts changed? (Currently 16k in LSL2 VM)
For the same LSL script the Mono bytecode and original (LSL2) bytecode will be of different size. In order to be compatible with all known scripts, we have expanded the size ceiling for Mono to be 64k. This is ok to do for Mono because unlike LSL2, Mono allocates memory dynamically, whereas all LSL2 scripts occupy 16K. Mono scripts only allocate the memory that they need.

64K? Wow, isn't that going to encourage inefficient scripting?
We hope that the change will promote more efficient scripting. Currently programmers have to get around the 16K limit by using multiple scripts, and a lot of cycles get spent on passing data between those scripts. With a single script that would not be necessary.

Are there other ways to make my scripts even more memory efficient when using Mono? ;
Indeed, Mono can do what's called bytecode sharing. Suppose you have a region which uses many instances of the same script, like XYText or Puppeteer, for example. As long as all the instances share the same asset id, the bytecode will only be added to memory once, and shared by all the copies. Key to making this work is ensuring that you simply copy the scripts (or the objects the scripts are within) after they have been saved for the final time. If you have purchased a script that is used many times, ask the creator for a Mono version, and then copy that version into the objects. It's important that you copy the scripts, so that the asset id is the same. If you recompile each instance separately, they will get different asset ids and the engine won't be able to share the bytecode.
Though, I've heard that the "Mono rezzing" lag symptom is the result of full memory allocation in one shot and that the wiki is possibly outdated and even incorrect in the first place. But, such is rumor and wiki. Can't tell what's what until we try it out. (^_^)y

Re: Lower lag

Posted: Wed Mar 02, 2011 11:17 pm
by Janet Rossini
i wonder just what they mean by "copy the script". Drag from inventory? Or ... ?