From 45c7789b54c4c04db908a0645ee58e7a285fcccd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 19:42:33 +0000
Subject: use a more efficient dictionary in OdeScene._collisionEventPrim
rather than a list
---
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index c3279c6..a4e5c1e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -221,7 +221,7 @@ namespace OpenSim.Region.Physics.OdePlugin
///
/// A list of actors that should receive collision events.
///
- private readonly List _collisionEventPrim = new List();
+ private readonly Dictionary _collisionEventPrim = new Dictionary();
private readonly HashSet _badCharacter = new HashSet();
public Dictionary geom_name_map = new Dictionary();
@@ -1636,10 +1636,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName);
lock (_collisionEventPrim)
- {
- if (!_collisionEventPrim.Contains(obj))
- _collisionEventPrim.Add(obj);
- }
+ _collisionEventPrim[obj.LocalID] = obj;
}
///
@@ -1651,7 +1648,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName);
lock (_collisionEventPrim)
- _collisionEventPrim.Remove(obj);
+ _collisionEventPrim.Remove(obj.LocalID);
}
#region Add/Remove Entities
@@ -2792,7 +2789,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
lock (_collisionEventPrim)
{
- foreach (PhysicsActor obj in _collisionEventPrim)
+ foreach (PhysicsActor obj in _collisionEventPrim.Values)
{
// m_log.DebugFormat("[PHYSICS]: Assessing {0} for collision events", obj.SOPName);
--
cgit v1.1