mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
* Change Util.FireAndForget to use ThreadPool.UnsafeQueueUserWorkItem(). This avoids .NET remoting and a managed->unmanaged->managed jump. Overall, a night and day performance difference
* Initialize the LLClientView prim full update queue to the number of prims in the scene for a big performance boost * Reordered some comparisons on hot code paths for a minor speed boost * Removed an unnecessary call to the expensive DateTime.Now function (if you *have* to get the current time as opposed to Environment.TickCount, always use DateTime.UtcNow) * Don't fire the queue empty callback for the Resend category * Run the outgoing packet handler thread loop for each client synchronously. It seems like more time was being spent doing the execution asynchronously, and it made deadlocks very difficult to track down * Rewrote some expensive math in LandObject.cs * Optimized EntityManager to only lock on operations that need locking, and use TryGetValue() where possible * Only update the attachment database when an object is attached or detached * Other small misc. performance improvements
This commit is contained in:
@@ -93,40 +93,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (m_lock)
|
||||
{
|
||||
return m_eb_uuid.Count;
|
||||
}
|
||||
return m_eb_uuid.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsKey(UUID id)
|
||||
{
|
||||
lock (m_lock)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_eb_uuid.ContainsKey(id);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_eb_uuid.ContainsKey(id);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsKey(uint localID)
|
||||
{
|
||||
lock (m_lock)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_eb_localID.ContainsKey(localID);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_eb_localID.ContainsKey(localID);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +127,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
try
|
||||
{
|
||||
bool a = m_eb_uuid.Remove(m_eb_localID[localID].UUID);
|
||||
bool a = false;
|
||||
EntityBase entity;
|
||||
if (m_eb_localID.TryGetValue(localID, out entity))
|
||||
a = m_eb_uuid.Remove(entity.UUID);
|
||||
|
||||
bool b = m_eb_localID.Remove(localID);
|
||||
return a && b;
|
||||
}
|
||||
@@ -154,7 +149,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
try
|
||||
{
|
||||
bool a = m_eb_localID.Remove(m_eb_uuid[id].LocalId);
|
||||
bool a = false;
|
||||
EntityBase entity;
|
||||
if (m_eb_uuid.TryGetValue(id, out entity))
|
||||
a = m_eb_localID.Remove(entity.LocalId);
|
||||
|
||||
bool b = m_eb_uuid.Remove(id);
|
||||
return a && b;
|
||||
}
|
||||
@@ -206,14 +205,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
lock (m_lock)
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_eb_uuid[id];
|
||||
}
|
||||
catch
|
||||
{
|
||||
EntityBase entity;
|
||||
if (m_eb_uuid.TryGetValue(id, out entity))
|
||||
return entity;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
set
|
||||
@@ -228,14 +224,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
lock (m_lock)
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_eb_localID[localID];
|
||||
}
|
||||
catch
|
||||
{
|
||||
EntityBase entity;
|
||||
if (m_eb_localID.TryGetValue(localID, out entity))
|
||||
return entity;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
set
|
||||
|
||||
@@ -2351,12 +2351,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
item = InventoryService.GetItem(item);
|
||||
|
||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
|
||||
IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
|
||||
if (ava != null)
|
||||
{
|
||||
ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
|
||||
}
|
||||
return att.UUID;
|
||||
}
|
||||
@@ -2402,12 +2396,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = InventoryService.GetItem(item);
|
||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
|
||||
|
||||
if (m_AvatarFactory != null)
|
||||
{
|
||||
m_log.InfoFormat("[SCENE INVENTORY]: Saving avatar attachment. AgentID:{0} ItemID:{1} AttachmentPoint:{2}", remoteClient.AgentId, itemID, AttachmentPt);
|
||||
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2447,12 +2435,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (TryGetAvatar(remoteClient.AgentId, out presence))
|
||||
{
|
||||
presence.Appearance.DetachAttachment(itemID);
|
||||
IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
|
||||
if (ava != null)
|
||||
{
|
||||
ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
|
||||
// Save avatar attachment information
|
||||
if (m_AvatarFactory != null)
|
||||
{
|
||||
m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID);
|
||||
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
|
||||
m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient);
|
||||
|
||||
@@ -228,6 +228,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected IXMLRPC m_xmlrpcModule;
|
||||
protected IWorldComm m_worldCommModule;
|
||||
protected IAvatarFactory m_AvatarFactory;
|
||||
public IAvatarFactory AvatarFactory
|
||||
{
|
||||
get { return m_AvatarFactory; }
|
||||
}
|
||||
protected IConfigSource m_config;
|
||||
protected IRegionSerialiserModule m_serialiser;
|
||||
protected IInterregionCommsOut m_interregionCommsOut;
|
||||
|
||||
@@ -467,7 +467,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
|
||||
{
|
||||
// If we can't take it, we can't attach it!
|
||||
//
|
||||
SceneObjectPart part = m_parentScene.GetSceneObjectPart(objectLocalID);
|
||||
if (part == null)
|
||||
return;
|
||||
@@ -477,9 +476,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
//
|
||||
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false);
|
||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
// Save avatar attachment information
|
||||
ScenePresence presence;
|
||||
if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
|
||||
{
|
||||
m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt);
|
||||
m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
|
||||
public SceneObjectGroup RezSingleAttachment(
|
||||
@@ -574,7 +580,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
|
||||
group.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
|
||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// Saves and gets itemID
|
||||
|
||||
@@ -899,7 +899,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SetAttachmentPoint(Convert.ToByte(attachmentpoint));
|
||||
|
||||
avatar.AddAttachment(this);
|
||||
m_log.DebugFormat("[SOG]: Added att {0} to avie {1}", UUID, avatar.UUID);
|
||||
m_log.Debug("[SOG]: Added attachment " + UUID + " to avatar " + avatar.UUID);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user