Thank you, dslake, for a set of patches to improve OpenSim startup

and idle performance.
remotes/origin/0.6.7-post-fixes
Melanie 2009-09-02 03:33:31 +01:00
parent 2fc3f61a42
commit f32de6fe88
8 changed files with 63 additions and 21 deletions

View File

@ -412,8 +412,8 @@ namespace OpenSim.Data.MySQL
public List<SceneObjectGroup> LoadObjects(UUID regionUUID) public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
{ {
UUID lastGroupID = UUID.Zero; UUID lastGroupID = UUID.Zero;
List<SceneObjectGroup> objects = new List<SceneObjectGroup>(); Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
List<SceneObjectPart> prims = new List<SceneObjectPart>(); Dictionary<UUID, SceneObjectPart> prims = new Dictionary<UUID, SceneObjectPart>();
SceneObjectGroup grp = null; SceneObjectGroup grp = null;
lock (m_Connection) lock (m_Connection)
@ -441,14 +441,14 @@ namespace OpenSim.Data.MySQL
else else
prim.Shape = BuildShape(reader); prim.Shape = BuildShape(reader);
prims.Add(prim); prims[prim.UUID] = prim;
UUID groupID = new UUID(reader["SceneGroupID"].ToString()); UUID groupID = new UUID(reader["SceneGroupID"].ToString());
if (groupID != lastGroupID) // New SOG if (groupID != lastGroupID) // New SOG
{ {
if (grp != null) if (grp != null)
objects.Add(grp); objects[grp.UUID] = grp;
lastGroupID = groupID; lastGroupID = groupID;
@ -487,16 +487,47 @@ namespace OpenSim.Data.MySQL
} }
if (grp != null) if (grp != null)
objects.Add(grp); objects[grp.UUID] = grp;
cmd.Dispose(); cmd.Dispose();
} }
foreach (SceneObjectPart part in prims) // Instead of attempting to LoadItems on every prim,
LoadItems(part); // most of which probably have no items... get a
// list from DB of all prims which have items and
// LoadItems only on those
List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>();
lock (m_Connection)
{
MySqlCommand itemCmd = m_Connection.CreateCommand();
itemCmd.CommandText = "select distinct primID from primitems";
IDataReader itemReader = ExecuteReader(itemCmd);
try
{
while (itemReader.Read())
{
if (!(itemReader["primID"] is DBNull))
{
UUID primID = new UUID(itemReader["primID"].ToString());
if (prims.ContainsKey(primID))
{
primsWithInventory.Add(prims[primID]);
}
}
}
}
finally
{
itemReader.Close();
}
itemCmd.Dispose();
}
foreach (SceneObjectPart prim in primsWithInventory)
{
LoadItems(prim);
}
m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
return new List<SceneObjectGroup>(objects.Values);
return objects;
} }
/// <summary> /// <summary>

View File

@ -998,7 +998,7 @@ namespace OpenSim.Region.Framework.Scenes
physicsMS2 = Environment.TickCount - physicsMS2; physicsMS2 = Environment.TickCount - physicsMS2;
if (m_frame % m_update_entitymovement == 0) if (m_frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateEntityMovement(); m_sceneGraph.UpdateScenePresenceMovement();
physicsMS = Environment.TickCount; physicsMS = Environment.TickCount;
if ((m_frame % m_update_physics == 0) && m_physics_enabled) if ((m_frame % m_update_physics == 0) && m_physics_enabled)

View File

@ -198,9 +198,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected internal void UpdateEntityMovement() protected internal void UpdateScenePresenceMovement()
{ {
List<EntityBase> moveEntities = GetEntities(); List<ScenePresence> moveEntities = GetScenePresences();
foreach (EntityBase entity in moveEntities) foreach (EntityBase entity in moveEntities)
{ {

View File

@ -1904,7 +1904,7 @@ namespace OpenSim.Region.Framework.Scenes
//return; //return;
//} //}
if (Util.DistanceLessThan(lastPhysGroupPos, AbsolutePosition, 0.02) && UsePhysics) if (UsePhysics && Util.DistanceLessThan(lastPhysGroupPos, AbsolutePosition, 0.02))
{ {
m_rootPart.UpdateFlag = 1; m_rootPart.UpdateFlag = 1;
lastPhysGroupPos = AbsolutePosition; lastPhysGroupPos = AbsolutePosition;
@ -1916,11 +1916,10 @@ namespace OpenSim.Region.Framework.Scenes
checkAtTargets(); checkAtTargets();
if (((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) if (UsePhysics && ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)))
&& UsePhysics)
{ {
m_rootPart.UpdateFlag = 1; m_rootPart.UpdateFlag = 1;

View File

@ -223,6 +223,11 @@ namespace OpenSim.Region.Physics.OdePlugin
set { m_localID = value; } set { m_localID = value; }
} }
public override int GetHashCode()
{
return (int)m_localID;
}
public override bool Grabbed public override bool Grabbed
{ {
set { return; } set { return; }

View File

@ -260,6 +260,11 @@ namespace OpenSim.Region.Physics.OdePlugin
m_localID = value; } m_localID = value; }
} }
public override int GetHashCode()
{
return (int)m_localID;
}
public override bool Grabbed public override bool Grabbed
{ {
set { return; } set { return; }

View File

@ -235,11 +235,11 @@ namespace OpenSim.Region.Physics.OdePlugin
private d.NearCallback nearCallback; private d.NearCallback nearCallback;
public d.TriCallback triCallback; public d.TriCallback triCallback;
public d.TriArrayCallback triArrayCallback; public d.TriArrayCallback triArrayCallback;
private readonly List<OdeCharacter> _characters = new List<OdeCharacter>(); private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
private readonly List<OdePrim> _prims = new List<OdePrim>(); private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
private readonly List<OdePrim> _activeprims = new List<OdePrim>(); private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
private readonly List<OdePrim> _taintedPrim = new List<OdePrim>(); private readonly HashSet<OdePrim> _taintedPrim = new HashSet<OdePrim>();
private readonly List<OdeCharacter> _taintedActors = new List<OdeCharacter>(); private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>();
private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();

View File

@ -501,6 +501,7 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
@ -3714,6 +3715,7 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>