MantisBT - opensim
View Issue Details
0008251opensim[REGION] Script Functionspublic2017-10-19 13:262017-10-20 14:37
Kayaker Magic 
 
normalminoralways
newopen 
Linux/monoOpen Sim 0.8.3, 0.9.0, 0.9.1 devseveral
master (dev code) 
 
3d6553afeee3d4605851b6f336c17d5a6b07c6ad
Grid (Multiple Regions per Sim)
ubODE
Mono / Linux64
Other
FireStorm
0008251: Mono 5.2 and 5.4 slow some script functions down by a factor of 55
When upgrading from mono 4.2.1 to 5.2 I noticed a decrease in the speed of list fetch functions (such as llList2Float). I used the timing test script I wrote for the related mantis 0008127 to measure the slowdown and found that fetches were taking 0.055ms on mono 5.2 and less than 0.001ms on mono 4.2.1. I tried upgrading to mono 5.4.0.201 and saw the same 0.055ms results, list fetches are >55 times slower on 5.4.


All tests were done on Ubuntu 16.04 Linux systems, I did not test under Microsoft .NET. At first all the instances had AppDomainLoading=false.

I tested OpenSim 0.9.1 dev, 0.9.0.0 release, and also 0.8.3 release (from the binaries downloaded from OSGrid.org). In all versions of OpenSim I saw the same results: list fetch functions are 0000057:0000055 times slower under mono 5.2 or 5.4 than they are under mono 4.2.

0.9.1 dev is git 3d6553afeee3d4605851b6f336c17d5a6b07c6ad

I tested with AppDomainLoading=true and was surprised that the problem reported in related mantis 0008127 was there! I recall only seeing this problem on instances running on Windows .NET systems. List fetches are 0002113:0005000 times slower with a combination of mono 5.x and AppDomainLoading=true.

The only way I found to get the list fetch speed back to normal was to switch back to mono 4.2.1 and make sure AppDomainLoading=false in the ini file. I did not try earlier versions of mono. Mono 4.2.1 is not one of the recommended versions. It cannot compile the OpenSim sources, but it does seem to run the binaries reasonably well. Perhaps switching to an even older version of mono, like 3.8, will allow you to both compile and run OpenSim.
Put the script below in a prim. Reset or rez the prim to start the statistics over. The second line of the floating text shows the average llList2Float time in seconds. On systems with mono 4.2.1 (or earlier?) fetches will take <1 microsecond, on systems running mono 5.2 or 5.4 the script will show that fetches take around 55 microseconds each.
    //llListFetch timing test
    //Rev 2.1 Put in loop to catch llGetTime resolution issue
    //Rev 2.0: simple list, mean and variance of results
    //Note: timer is only used to generate a bunch of test results
    //there is no dependency on the accuracy of timer events
    //only llGetTime is used to measure the time to perform a fetch
float sum=0.0;
float sum2=0.0;
float n=0;
list test=[];
 default
 {
     state_entry()
     {
         integer i;
         for (i=0;i<500;i++) //create a list
             test += [llFrand(500.0)];
         llSetTimerEvent(0.5);
     }
     on_rez(integer param)
     {
         llResetScript();
     }
     timer()
     {
         float r;
         integer i;
         llResetTime();
         for (i=0;i<1000;i++)
            r=llList2Float(test,(integer)llFrand(500.0)); //random fetch
         float time = llGetTime(); //how long did that take?
         sum += time;
         sum2 += time*time;
         n += 1000.0;
         llSetText("last="+(string)(time/1000.0)+
         " n="+(string)((integer)n)+
         "\nmean="+(string)(sum/n)+
        " var="+(string)(sum2/n-sum*sum/n/n),
        <0,1,0>,1.0); //display results
     }
 }
No tags attached.
Issue History
2017-10-19 13:26Kayaker MagicNew Issue
2017-10-19 13:45UbitUmarovNote Added: 0032353
2017-10-20 03:50JeffKelleyNote Added: 0032354
2017-10-20 03:51BillBlightNote Added: 0032355
2017-10-20 12:22smxyNote Added: 0032356
2017-10-20 14:37OtakuMeganeNote Added: 0032357

Notes
(0032353)
UbitUmarov   
2017-10-19 13:45   
tested on VM, on a now old Xeon cpu, and got 0.000156ms on your script.
opensim compiled and running on a 5.2 mono version
this does not tell much since I can't test 4.x on it now :(
(0032354)
JeffKelley   
2017-10-20 03:50   
MONO 4.3.2, Xeon E3-1225
mean = 0.000000 (S)

After multiplying by 10^6:
mean = 0.25 (┬ÁS)
(0032355)
BillBlight   
2017-10-20 03:51   
I just ran this and I am getting .000057 on average ...
(0032356)
smxy   
2017-10-20 12:22   
mean = 0.000226
var = 0.000052

OpenSim 0.9.1.0 Dev a4e7ab6 2017-08-03 18:09:26 +0100 [CentOS 7.3.1611/Mono 5.4.0.56] (Unix/Mono)
(0032357)
OtakuMegane   
2017-10-20 14:37   
Xeon X5670
CentOS 6.9, Mono 5.2.0.196
OpenSim 0.9.1.0 Dev 59afeb6

AppDomainLoading off:
mean = 0.000062
var = 0.000004

AppDomainLoading on:
mean = 0.003596
var = 0.012909