diff options
author | Dan Lake | 2010-06-08 16:30:51 -0700 |
---|---|---|
committer | John Hurliman | 2010-06-08 16:44:18 -0700 |
commit | ca2abc43ad440a99f17b43d32de89e77fdeef00e (patch) | |
tree | ac8787b8db9c38d4875cc4123245006084e35609 /OpenSim/Region/Framework/Scenes/SceneGraph.cs | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-ca2abc43ad440a99f17b43d32de89e77fdeef00e.zip opensim-SC-ca2abc43ad440a99f17b43d32de89e77fdeef00e.tar.gz opensim-SC-ca2abc43ad440a99f17b43d32de89e77fdeef00e.tar.bz2 opensim-SC-ca2abc43ad440a99f17b43d32de89e77fdeef00e.tar.xz |
Refactor SendCoarseLocations for better performance. Instead of computing list of all locations fresh for every scene presence on every frame, we will instead compute the list once every 50 frames and send to all connected presences at that time. Also, we only add 60 items to the list when there are more than 60 presences in the scene. For 1000 users, this change yields a 99.8% reduction in list processing and a 98% reduction in network bandwidth for coarse locations.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 5902080..673674d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -206,6 +206,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | }); | 206 | }); |
207 | } | 207 | } |
208 | 208 | ||
209 | public void GetCoarseLocations(out List<Vector3> coarseLocations, out List<UUID> avatarUUIDs, uint maxLocations) | ||
210 | { | ||
211 | coarseLocations = new List<Vector3>(); | ||
212 | avatarUUIDs = new List<UUID>(); | ||
213 | |||
214 | List<ScenePresence> presences = GetScenePresences(); | ||
215 | for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) | ||
216 | { | ||
217 | ScenePresence sp = presences[i]; | ||
218 | // If this presence is a child agent, we don't want its coarse locations | ||
219 | if (sp.IsChildAgent) | ||
220 | return; | ||
221 | |||
222 | if (sp.ParentID != 0) | ||
223 | { | ||
224 | // sitting avatar | ||
225 | SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID); | ||
226 | if (sop != null) | ||
227 | { | ||
228 | coarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition); | ||
229 | avatarUUIDs.Add(sp.UUID); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | // we can't find the parent.. ! arg! | ||
234 | coarseLocations.Add(sp.AbsolutePosition); | ||
235 | avatarUUIDs.Add(sp.UUID); | ||
236 | } | ||
237 | } | ||
238 | else | ||
239 | { | ||
240 | coarseLocations.Add(sp.AbsolutePosition); | ||
241 | avatarUUIDs.Add(sp.UUID); | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | |||
209 | #endregion | 246 | #endregion |
210 | 247 | ||
211 | #region Entity Methods | 248 | #region Entity Methods |