[Opensim-users] Scripting: 10x speed boost with C#

Jorge Lima jorge.manuel at gmail.com
Tue May 3 17:46:15 UTC 2011


If I understood correctly, they "transform" LSL into C#, which means
they compile an automatic translation of LSL into C#, and then it runs
as a standard C# program.
This could mean that some translator optimization is in order, which
would immediately benefit everyone with an LSL installed base.

On Mon, May 2, 2011 at 8:19 PM, Karen Palen <karenpalensl at gmail.com> wrote:
> Is this really saying that compiled code executes math functions faster
> than interpreted code?
>
> I don't really see this as a language specific thing based on what you
> are saying (although I am sure we all agree that LSL is a total mess
> from a language design viewpoint).
>
> The deeper question is where to go from here for OpenSimulator. Simply
> dumping all the installed scripts would be far too painful - ask any
> Cobol programmer - but hopefully we do not have to repeat past mistakes!
>
> Karen
>
> On 05/02/2011 05:11 AM, Jeff Kelley wrote:
>> At 4:36 AM +0100 4/25/11, Justin Clark-Casey wrote:
>>
>>> Very interesting, Jeff.  The scripting engine in OpenSim transforms LSL to C#
>>> before compiling it so there wouldn't be a time difference due to
>>> interpretation.
>>>
>>> Of course, I'm presuming that you had configured all LSL scripting delays down
>>> to zero
>>
>> No, because I was not aware of that option.
>>
>> With ScriptDelayFactor = 0.0, the LSL version changes from an average of
>> 2.15s to 2.10s. No big deal. The C# version is still around 0.2s.
>>
>> I switched to C# because i noticed my script spent most of its time into
>> list handling (llList2Rot, which was a first speed gain over
>> 4*llList2Float). Since LSL has no array structure, we use lists to emulate
>> them and waste a lot of time here.
>>
>> Then, replacing llPow with System.Math.Pow gave me another speed boost.
>> Finally, replacing osSetPenColour, osDrawLine with direct drawlist
>> manipuations (drawList += ) accounted for the overall 10x speed increase.
>>
>> Of course, that depends a lot on your application. If you are manipulating
>> prims, the gain may be near zero. If you do a lot of math and matrixes, it
>> may be higher.
>> _______________________________________________
>> Opensim-users mailing list
>> Opensim-users at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/opensim-users
>
> _______________________________________________
> Opensim-users mailing list
> Opensim-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-users
>



More information about the Opensim-users mailing list