* 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:
John Hurliman
2009-10-19 15:19:09 -07:00
parent 6d04a213d6
commit 142008121e
12 changed files with 129 additions and 130 deletions

View File

@@ -1273,7 +1273,7 @@ namespace OpenSim.Framework
/// <summary>
/// Created to work around a limitation in Mono with nested delegates
/// </summary>
private class FireAndForgetWrapper
/*private class FireAndForgetWrapper
{
public void FireAndForget(System.Threading.WaitCallback callback)
{
@@ -1284,21 +1284,23 @@ namespace OpenSim.Framework
{
callback.BeginInvoke(obj, EndFireAndForget, callback);
}
}
}*/
public static void FireAndForget(System.Threading.WaitCallback callback)
{
FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
wrapper.FireAndForget(callback);
//FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
//wrapper.FireAndForget(callback);
System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, null);
}
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
{
FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
wrapper.FireAndForget(callback, obj);
//FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
//wrapper.FireAndForget(callback, obj);
System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, obj);
}
private static void EndFireAndForget(IAsyncResult ar)
/*private static void EndFireAndForget(IAsyncResult ar)
{
System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState;
@@ -1306,7 +1308,7 @@ namespace OpenSim.Framework
catch (Exception ex) { m_log.Error("[UTIL]: Asynchronous method threw an exception: " + ex.Message, ex); }
ar.AsyncWaitHandle.Close();
}
}*/
#endregion FireAndForget Threading Pattern
}