Removed an innefficent List.Contains lookup from UpdateQueue

Changed the underlying data structure used to detected duplicate
in OpenSim.Region.Framework.Scenes.Types.UpdateQueue from a
List to a Dictionary.
0.6.8-post-fixes
James J Greensky 2009-09-30 16:52:59 -07:00 committed by John Hurliman
parent cb26878f96
commit 8e3dd64282
1 changed files with 4 additions and 5 deletions

View File

@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Scenes.Types
{ {
private Queue<SceneObjectPart> m_queue; private Queue<SceneObjectPart> m_queue;
private List<UUID> m_ids; private Dictionary<UUID, bool> m_ids;
private object m_syncObject = new object(); private object m_syncObject = new object();
@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Types
public UpdateQueue() public UpdateQueue()
{ {
m_queue = new Queue<SceneObjectPart>(); m_queue = new Queue<SceneObjectPart>();
m_ids = new List<UUID>(); m_ids = new Dictionary<UUID, bool>();
} }
public void Clear() public void Clear()
@ -66,9 +66,8 @@ namespace OpenSim.Region.Framework.Scenes.Types
{ {
lock (m_syncObject) lock (m_syncObject)
{ {
if (!m_ids.Contains(part.UUID)) if (!m_ids.ContainsKey(part.UUID)) {
{ m_ids.Add(part.UUID, true);
m_ids.Add(part.UUID);
m_queue.Enqueue(part); m_queue.Enqueue(part);
} }
} }