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)
{
UUID lastGroupID = UUID.Zero;
List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
List<SceneObjectPart> prims = new List<SceneObjectPart>();
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
Dictionary<UUID, SceneObjectPart> prims = new Dictionary<UUID, SceneObjectPart>();
SceneObjectGroup grp = null;
lock (m_Connection)
@ -441,14 +441,14 @@ namespace OpenSim.Data.MySQL
else
prim.Shape = BuildShape(reader);
prims.Add(prim);
prims[prim.UUID] = prim;
UUID groupID = new UUID(reader["SceneGroupID"].ToString());
if (groupID != lastGroupID) // New SOG
{
if (grp != null)
objects.Add(grp);
objects[grp.UUID] = grp;
lastGroupID = groupID;
@ -487,16 +487,47 @@ namespace OpenSim.Data.MySQL
}
if (grp != null)
objects.Add(grp);
objects[grp.UUID] = grp;
cmd.Dispose();
}
foreach (SceneObjectPart part in prims)
LoadItems(part);
// Instead of attempting to LoadItems on every prim,
// 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);
return objects;
return new List<SceneObjectGroup>(objects.Values);
}
/// <summary>

View File

@ -998,7 +998,7 @@ namespace OpenSim.Region.Framework.Scenes
physicsMS2 = Environment.TickCount - physicsMS2;
if (m_frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateEntityMovement();
m_sceneGraph.UpdateScenePresenceMovement();
physicsMS = Environment.TickCount;
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)
{

View File

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

View File

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

View File

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

View File

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

View File

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