A couple of small optimizations over the previous commit

cpu-performance
Diva Canto 2013-07-20 13:42:39 -07:00
parent 0910c5c101
commit 340abd1110
2 changed files with 11 additions and 9 deletions

View File

@ -5587,6 +5587,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name='x'></param> /// <param name='x'></param>
public bool CheckAgentUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) public bool CheckAgentUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
{ {
// Compute these only once, when this function is called from down below
qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2);
//qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2);
vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
return CheckAgentMovementUpdateSignificance(x) || CheckAgentCameraUpdateSignificance(x); return CheckAgentMovementUpdateSignificance(x) || CheckAgentCameraUpdateSignificance(x);
} }
@ -5596,10 +5604,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <remarks>Can only be called by one thread at a time</remarks> /// <remarks>Can only be called by one thread at a time</remarks>
/// <returns></returns> /// <returns></returns>
/// <param name='x'></param> /// <param name='x'></param>
public bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
{ {
qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2);
qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2);
if ( if (
(qdelta1 > QDELTA) || (qdelta1 > QDELTA) ||
// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
@ -5626,12 +5632,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <remarks>Can only be called by one thread at a time</remarks> /// <remarks>Can only be called by one thread at a time</remarks>
/// <returns></returns> /// <returns></returns>
/// <param name='x'></param> /// <param name='x'></param>
public bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
{ {
vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
if ( if (
/* These 4 are the worst offenders! /* These 4 are the worst offenders!
* With Singularity, there is a bug where sometimes the spam on these doesn't stop */ * With Singularity, there is a bug where sometimes the spam on these doesn't stop */

View File

@ -1735,7 +1735,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// This is the event handler for client cameras. If a client is moving, or moving the camera, this event is triggering. /// This is the event handler for client cameras. If a client is moving, or moving the camera, this event is triggering.
/// </summary> /// </summary>
public void HandleAgentCamerasUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) private void HandleAgentCamerasUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{ {
//m_log.DebugFormat( //m_log.DebugFormat(
// "[SCENE PRESENCE]: In {0} received agent camera update from {1}, flags {2}", // "[SCENE PRESENCE]: In {0} received agent camera update from {1}, flags {2}",