• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: SVC-2750
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Babbage Linden
Reporter: Haravikk Mistral
Votes: 4
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
2. Second Life Service - SVC

State changes are several times slower on MONO servers

Created: 05/Aug/08 07:09 AM   Updated: 22/Jan/09 10:41 PM
Return to search
Component/s: Scripts
Affects Version/s: Mono Beta
Fix Version/s: None

Environment:
Second Life 1.20.15 (93532) Aug 1 2008 15:51:40 (Second Life Release)

You are at 255776.0, 255317.8, 21.5 in Sandbox Cordova MONO located at sim18.aditi.lindenlab.com (8.4.131.211:13000)
Second Life Beta Server 1.24.4.93464

CPU: 8 x i386 (Unknown) (3200 MHz)
Memory: 10240 MB
OS Version: Darwin 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386
Graphics Card Vendor: NVIDIA Corporation
Graphics Card: NVIDIA GeForce 8800 GT OpenGL Engine
OpenGL Version: 2.0 NVIDIA-1.5.28
LLMozLib Version: [LLMediaImplLLMozLib] - 2.01.17128 (Mozilla GRE version 1.8.1.13_0000000000)
Packets Lost: 29/29961 (0.1%)
Issue Links:
Relates
 

Linden Lab Issue ID: DEV-18976


 Description  « Hide
I've recently tested a script-performance benchmarking tool I made on the Mono grid, and have found that while performance of many operations are MUCH faster when compared to LSL2, that there is a major weakness in the Mono server.

Below is a simple script that shows the portion of my benchmarking tool used to test state-transitions. On a typical class 5 mainland sim on the main (non-preview) grid, state-changes are executed at approximately 0.0002 seconds per transition. The transitions perform even faster on empty, non-MONO simulators on the preview-grid as well.
However, in MONO regions on the preview grid, state-changes are taking closer to 0.02 seconds to complete, which is around 100 times slower or worse!

Simply throw the following script into an object on a MONO enabled region, and a non-MONO enabled region for comparison. For the sake of argument run both as LSL2 scripts. There is no noticeable difference in speed between running the following script as LSL2 or Mono, both are equally slow on a MONO region.

Here are some preview grid sample times:

Abotts (non-Mono empty): 0.001760
Fortuna (Havok 1, empty): 0.002444
Fame (Havok 1, slow simulator): 0.002451
Ahern (slow simulator): 0.004138
Sandbox Wanderton (Mono, empty): 0.023679
Sandbox Coguen (Mono, non-empty): 0.023686
Sandbox Cordova (Mono, empty): 0.023744

-------------------------------------------------------------
integer counter = 0;

default {
state_entry() { llResetTime(); state state1; }
}

state state1 {
state_entry() { state state2; }
}

state state2 {
state_entry() {
if ((++counter) >= 100) { float time = llGetTime() / 200.0; llOwnerSay((string)time + " seconds/state-change"); } else state state1;
}
}



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Haravikk Mistral made changes - 05/Aug/08 07:26 AM
Field Original Value New Value
Description I've recently tested a script-performance benchmarking tool I made on the Mono grid, and have found that while performance of many operations are MUCH faster when compared to LSL2, that there is a major weakness in the Mono server.

Below is a simple script that shows the portion of my benchmarking tool used to test state-transitions. On a typical class 5 mainland sim on the main (non-preview) grid, state-changes are executed at approximately 0.0002 seconds per transition. The transitions perform even faster on empty, non-MONO simulators on the preview-grid as well.
However, in MONO regions on the preview grid, state-changes are taking closer to 0.02 seconds to complete, which is around 100 times slower or worse!

Simply throw the following script into an object on a MONO enabled region, and a non-MONO enabled region for comparison. For the sake of argument run both as LSL2 scripts. There is no noticeable difference in speed between running the following script as LSL2 or Mono, both are equally slow on a MONO region.

-------------------------------------------------------------
integer counter = 0;

default {
    state_entry() {
        llResetTime();
        state state1;
    }
}

state state1 {
    state_entry() {
        state state2;
    }
}

state state2 {
    state_entry() {
        if ((++counter) >= 100) {
            float time = llGetTime() / 200.0;
            llOwnerSay((string)time + " seconds/state-change");
        }
    }
}
I've recently tested a script-performance benchmarking tool I made on the Mono grid, and have found that while performance of many operations are MUCH faster when compared to LSL2, that there is a major weakness in the Mono server.

Below is a simple script that shows the portion of my benchmarking tool used to test state-transitions. On a typical class 5 mainland sim on the main (non-preview) grid, state-changes are executed at approximately 0.0002 seconds per transition. The transitions perform even faster on empty, non-MONO simulators on the preview-grid as well.
However, in MONO regions on the preview grid, state-changes are taking closer to 0.02 seconds to complete, which is around 100 times slower or worse!

Simply throw the following script into an object on a MONO enabled region, and a non-MONO enabled region for comparison. For the sake of argument run both as LSL2 scripts. There is no noticeable difference in speed between running the following script as LSL2 or Mono, both are equally slow on a MONO region.

-------------------------------------------------------------
integer counter = 0;

default {
    state_entry() {
        llResetTime();
        state state1;
    }
}

state state1 {
    state_entry() {
        state state2;
    }
}

state state2 {
    state_entry() {
        if ((++counter) >= 100) {
            float time = llGetTime() / 200.0;
            llOwnerSay((string)time + " seconds/state-change");
        } else state1;
    }
}
Haravikk Mistral made changes - 05/Aug/08 07:27 AM
Description I've recently tested a script-performance benchmarking tool I made on the Mono grid, and have found that while performance of many operations are MUCH faster when compared to LSL2, that there is a major weakness in the Mono server.

Below is a simple script that shows the portion of my benchmarking tool used to test state-transitions. On a typical class 5 mainland sim on the main (non-preview) grid, state-changes are executed at approximately 0.0002 seconds per transition. The transitions perform even faster on empty, non-MONO simulators on the preview-grid as well.
However, in MONO regions on the preview grid, state-changes are taking closer to 0.02 seconds to complete, which is around 100 times slower or worse!

Simply throw the following script into an object on a MONO enabled region, and a non-MONO enabled region for comparison. For the sake of argument run both as LSL2 scripts. There is no noticeable difference in speed between running the following script as LSL2 or Mono, both are equally slow on a MONO region.

-------------------------------------------------------------
integer counter = 0;

default {
    state_entry() {
        llResetTime();
        state state1;
    }
}

state state1 {
    state_entry() {
        state state2;
    }
}

state state2 {
    state_entry() {
        if ((++counter) >= 100) {
            float time = llGetTime() / 200.0;
            llOwnerSay((string)time + " seconds/state-change");
        } else state1;
    }
}
I've recently tested a script-performance benchmarking tool I made on the Mono grid, and have found that while performance of many operations are MUCH faster when compared to LSL2, that there is a major weakness in the Mono server.

Below is a simple script that shows the portion of my benchmarking tool used to test state-transitions. On a typical class 5 mainland sim on the main (non-preview) grid, state-changes are executed at approximately 0.0002 seconds per transition. The transitions perform even faster on empty, non-MONO simulators on the preview-grid as well.
However, in MONO regions on the preview grid, state-changes are taking closer to 0.02 seconds to complete, which is around 100 times slower or worse!

Simply throw the following script into an object on a MONO enabled region, and a non-MONO enabled region for comparison. For the sake of argument run both as LSL2 scripts. There is no noticeable difference in speed between running the following script as LSL2 or Mono, both are equally slow on a MONO region.

-------------------------------------------------------------
integer counter = 0;

default {
    state_entry() {
        llResetTime();
        state state1;
    }
}

state state1 {
    state_entry() {
        state state2;
    }
}

state state2 {
    state_entry() {
        if ((++counter) >= 100) {
            float time = llGetTime() / 200.0;
            llOwnerSay((string)time + " seconds/state-change");
        } else state state1;
    }
}
Haravikk Mistral made changes - 05/Aug/08 07:35 AM
Summary State changes are hundreds of times slower on MONO servers State changes are several times slower on MONO servers
Description I've recently tested a script-performance benchmarking tool I made on the Mono grid, and have found that while performance of many operations are MUCH faster when compared to LSL2, that there is a major weakness in the Mono server.

Below is a simple script that shows the portion of my benchmarking tool used to test state-transitions. On a typical class 5 mainland sim on the main (non-preview) grid, state-changes are executed at approximately 0.0002 seconds per transition. The transitions perform even faster on empty, non-MONO simulators on the preview-grid as well.
However, in MONO regions on the preview grid, state-changes are taking closer to 0.02 seconds to complete, which is around 100 times slower or worse!

Simply throw the following script into an object on a MONO enabled region, and a non-MONO enabled region for comparison. For the sake of argument run both as LSL2 scripts. There is no noticeable difference in speed between running the following script as LSL2 or Mono, both are equally slow on a MONO region.

-------------------------------------------------------------
integer counter = 0;

default {
    state_entry() {
        llResetTime();
        state state1;
    }
}

state state1 {
    state_entry() {
        state state2;
    }
}

state state2 {
    state_entry() {
        if ((++counter) >= 100) {
            float time = llGetTime() / 200.0;
            llOwnerSay((string)time + " seconds/state-change");
        } else state state1;
    }
}
I've recently tested a script-performance benchmarking tool I made on the Mono grid, and have found that while performance of many operations are MUCH faster when compared to LSL2, that there is a major weakness in the Mono server.

Below is a simple script that shows the portion of my benchmarking tool used to test state-transitions. On a typical class 5 mainland sim on the main (non-preview) grid, state-changes are executed at approximately 0.0002 seconds per transition. The transitions perform even faster on empty, non-MONO simulators on the preview-grid as well.
However, in MONO regions on the preview grid, state-changes are taking closer to 0.02 seconds to complete, which is around 100 times slower or worse!

Simply throw the following script into an object on a MONO enabled region, and a non-MONO enabled region for comparison. For the sake of argument run both as LSL2 scripts. There is no noticeable difference in speed between running the following script as LSL2 or Mono, both are equally slow on a MONO region.

Here are some preview grid sample times:

Abotts (non-Mono empty): 0.001760
Fortuna (Havok 1, empty): 0.002444
Fame (Havok 1, slow simulator): 0.002451
Ahern (slow simulator): 0.004138
Sandbox Wanderton (Mono, empty): 0.023679
Sandbox Coguen (Mono, non-empty): 0.023686
Sandbox Cordova (Mono, empty): 0.023744

-------------------------------------------------------------
integer counter = 0;

default {
    state_entry() {
        llResetTime();
        state state1;
    }
}

state state1 {
    state_entry() {
        state state2;
    }
}

state state2 {
    state_entry() {
        if ((++counter) >= 100) {
            float time = llGetTime() / 200.0;
            llOwnerSay((string)time + " seconds/state-change");
        } else state state1;
    }
}
Gellan Glenelg made changes - 05/Aug/08 09:26 AM
Link This issue Relates to SVC-1276 [ SVC-1276 ]
Moon Metty added a comment - 05/Aug/08 09:42 AM
Second Life 1.20.15 (93532) Aug 1 2008 15:59:25 (Second Life Release)

You are at 255740.8, 255335.9, 21.0 in Sandbox Goguen MONO located at sim3017.aditi.lindenlab.com (216.82.2.23:13002)
Second Life Beta Server 1.24.4.93464

=======

Look at the comparison between LSL and Mono:

[9:01] SVC-2746 LSL: 0.022235 seconds/state-change
[9:01] SVC-2746 Mono: 0.022235 seconds/state-change
[9:01] SVC-2746 LSL: 0.022238 seconds/state-change
[9:01] SVC-2746 Mono: 0.022233 seconds/state-change
[9:01] SVC-2746 LSL: 0.022860 seconds/state-change
[9:01] SVC-2746 Mono: 0.022233 seconds/state-change
[9:01] SVC-2746 LSL: 0.022240 seconds/state-change
[9:01] SVC-2746 Mono: 0.022236 seconds/state-change
[9:01] SVC-2746 LSL: 0.022234 seconds/state-change
[9:02] SVC-2746 Mono: 0.022238 seconds/state-change
[9:02] SVC-2746 LSL: 0.022237 seconds/state-change
[9:02] SVC-2746 Mono: 0.022237 seconds/state-change

The results are identical and very constant.

========

There seems to be a built-in delay, look at the results from this script:

default
{
state_entry()

{ llResetTime(); state state1; }

}
state state1
{
state_entry()

{ llOwnerSay((string)llGetTime() + " seconds/single-state-change"); }

}

[9:37] SVC-2746 Mono: 0.021857 seconds/single-state-change
[9:37] SVC-2746 Mono: 0.022306 seconds/single-state-change
[9:37] SVC-2746 Mono: 0.021260 seconds/single-state-change
[9:37] SVC-2746 Mono: 0.021777 seconds/single-state-change
[9:37] SVC-2746 Mono: 0.021554 seconds/single-state-change
[9:37] SVC-2746 Mono: 0.021870 seconds/single-state-change
[9:37] SVC-2746 Mono: 0.021511 seconds/single-state-change
[9:37] SVC-2746 Mono: 0.021274 seconds/single-state-change

Again we see very constant results.


Haravikk Mistral made changes - 05/Aug/08 10:26 AM
Link This issue is related to by SVC-1276 [ SVC-1276 ]
Lex Neva added a comment - 05/Aug/08 11:13 AM
Hmm... so both of you are seeing results indicating that state transitions for both LSL AND Mono scripts are running slowly in sims with Mono. It could be that there's a bug in the Mono sims making this slower... but couldn't it also be that those Mono sims are just on slower hardware?

Moon Metty added a comment - 05/Aug/08 01:15 PM - edited
Second Life 1.20.15 (92456) Jul 18 2008 10:58:42 (Second Life Release)
You are at 251719.4, 246593.2, 406.5 in Neptune located at sim4540.agni.lindenlab.com (63.210.158.190:12035)
Second Life Server 1.23.4.93100

This is the output of Haravikk's script on the main grid:

[12:15] Object: 0.000223 seconds/state-change
[12:15] Object: 0.000218 seconds/state-change
[12:15] Object: 0.000221 seconds/state-change
[12:15] Object: 0.000218 seconds/state-change
[12:15] Object: 0.000226 seconds/state-change
[12:15] Object: 0.000219 seconds/state-change
[12:15] Object: 0.000224 seconds/state-change

Indeed, there's a factor 100 between the servers.

=======

The single-state-change script gives this output on the main grid:

[12:25] Object: 0.000000 seconds/single-state-change
[12:25] Object: 0.000000 seconds/single-state-change
[12:25] Object: 0.000000 seconds/single-state-change
[12:25] Object: 0.000000 seconds/single-state-change
[12:25] Object: 0.000000 seconds/single-state-change
[12:25] Object: 0.000000 seconds/single-state-change

Ummm ...

=======

Here's a different way of measuring:

float seconds;
integer counter;
default
{
state_entry()
{ // wait for the seconds to change
seconds = llGetWallclock();
while (seconds == llGetWallclock())

{ seconds = llGetWallclock(); }

seconds = llGetWallclock();
state state1;
}
}
state state1
{
state_entry()

{ counter ++; state state2; }

}
state state2 {
state_entry()
{
if (seconds != llGetWallclock())

{ llOwnerSay((string)(1/(float)counter)); }

else state state1;
}
}

[12:47] agni: 0.001269
[12:47] agni: 0.001267
[12:47] agni: 0.001351
[12:47] agni: 0.001256
[12:47] agni: 0.001401
[12:47] agni: 0.001311
[12:48] agni: 0.001267

LSL:
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478

Mono:
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478
[12:52] aditi: 0.043478

A factor of 33
The aditi results are absolutely constant. This can't be due to slower hardware.
[This way of measuring uses an integer. It only counts to 23 on aditi, so that explains why it is so constant.]


lindenrobot made changes - 06/Aug/08 05:27 PM
Linden Lab Issue ID DEV-18976
Periapse Linden made changes - 08/Aug/08 08:54 AM
Link This issue is related to by SVC-1276 [ SVC-1276 ]
Haravikk Mistral added a comment - 09/Aug/08 04:14 PM
Since an LL issue ID has been assigned to this can we please get a comment regarding the problem?

As I understand it, the engine running legacy LSL scripts has actually changed slightly, to dynamically adjust memory, and possibly a few other things, meaning it is more in-line with the Mono engine's behaviour despite still being an interpreted engine. I'm assuming one of these changes must be the cause of the far slower state changes.

This has me concerned though, as I've been using states heavily to write a parser, as they're not only much easier to develop, but were more efficient as it means I don't need a huge if statement tree just to keep track of state as I look at each character of the input. Slower state-changes will significantly reduce the performance of my script in-spite of the other Mono speed improvements.


Babbage Linden added a comment - 11/Aug/08 10:52 AM
I think what's happening here is that state changes are being clamped to 1 per frame.

Moon Metty added a comment - 11/Aug/08 01:40 PM
It looks like you're right, Babbage

Try this modification to Haravikk's script:

llOwnerSay((string)(time * llGetRegionFPS()) + " seconds/state-change*sim_FPS");

The output looks like this (while the sim's FPS is varying from 20 to 45):

[13:24] Object: 1.082572 seconds/state-change*sim_FPS
[13:25] Object: 1.057073 seconds/state-change*sim_FPS
[13:25] Object: 1.200339 seconds/state-change*sim_FPS
[13:25] Object: 0.776695 seconds/state-change*sim_FPS
[13:25] Gellan Glenelg: LOL
[13:25] Object: 1.328234 seconds/state-change*sim_FPS
[13:25] Object: 0.887612 seconds/state-change*sim_FPS
[13:25] Object: 1.180765 seconds/state-change*sim_FPS

All values are fairly close to 1.


Haravikk Mistral added a comment - 11/Aug/08 02:13 PM
Hmm, is this likely to be changed Babbage? With Mono's speed increases it's possible for my parser to do quite a bit of work in a single frame, meaning that it could change state 3 or 4 times a frame, possibly more, especially with input strings that contain several short input types. I appreciate that you probably don't want scripts constantly changing state all the time, but a limit of 1 per frame may be too harsh.

Babbage Linden made changes - 29/Aug/08 06:49 AM
Assignee Babbage Linden [ Babbage Linden ]
Babbage Linden made changes - 29/Aug/08 06:49 AM
Status Open [ 1 ] Fix Pending [ 10001 ]
RobbyRacoon Olmstead made changes - 31/Aug/08 12:26 PM
Link This issue is related to by SVC-2958 [ SVC-2958 ]
Escort DeFarge added a comment - 01/Sep/08 12:43 AM - edited
I would argue that any constraint on state changes is antithetical to the spirit of LSL as a language.

If state changes are clamped, then scripters will resort to heavier use of globals, which will result in more buggy code and as a result fewer rich LSL applications.

The VM should support the best use of language (as does the LSL2 VM) not limit its use and expressiveness owing to the limitations of the underlying platform.


Periapse Linden made changes - 02/Sep/08 10:35 AM
Link This issue is related to by SVC-1276 [ SVC-1276 ]
Periapse Linden made changes - 02/Sep/08 10:38 AM
Link This issue Relates to SVC-1276 [ SVC-1276 ]
Periapse Linden made changes - 14/Oct/08 09:39 AM
Status Fix Pending [ 10001 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Sue Linden made changes - 13/Nov/08 12:10 PM
Workflow jira-2007-12-22a [ 57994 ] jira-2008-11-14 [ 82568 ]
Sue Linden made changes - 13/Nov/08 04:46 PM
Workflow jira-2008-11-14 [ 82568 ] jira-2008-11-14a [ 92057 ]
Gellan Glenelg made changes - 18/Jan/09 09:57 AM
Link This issue is related to by SVC-3691 [ SVC-3691 ]
Harleen Gretzky made changes - 22/Jan/09 10:41 PM
Link This issue is related to by SVC-3707 [ SVC-3707 ]