aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-19 15:19:09 -0700
committerJohn Hurliman2009-10-19 15:19:09 -0700
commit142008121e2e9c5ca5fca5de07b8a14e37279800 (patch)
tree003824e2639ba00636e3133d2f991b62d8b79bdc /OpenSim/Framework/Util.cs
parentMerge branch 'prioritization' of ssh://opensimulator.org/var/git/opensim into... (diff)
downloadopensim-SC_OLD-142008121e2e9c5ca5fca5de07b8a14e37279800.zip
opensim-SC_OLD-142008121e2e9c5ca5fca5de07b8a14e37279800.tar.gz
opensim-SC_OLD-142008121e2e9c5ca5fca5de07b8a14e37279800.tar.bz2
opensim-SC_OLD-142008121e2e9c5ca5fca5de07b8a14e37279800.tar.xz
* 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
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs18
1 files changed, 10 insertions, 8 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 3203fc1..d5ae3b7 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1273,7 +1273,7 @@ namespace OpenSim.Framework
1273 /// <summary> 1273 /// <summary>
1274 /// Created to work around a limitation in Mono with nested delegates 1274 /// Created to work around a limitation in Mono with nested delegates
1275 /// </summary> 1275 /// </summary>
1276 private class FireAndForgetWrapper 1276 /*private class FireAndForgetWrapper
1277 { 1277 {
1278 public void FireAndForget(System.Threading.WaitCallback callback) 1278 public void FireAndForget(System.Threading.WaitCallback callback)
1279 { 1279 {
@@ -1284,21 +1284,23 @@ namespace OpenSim.Framework
1284 { 1284 {
1285 callback.BeginInvoke(obj, EndFireAndForget, callback); 1285 callback.BeginInvoke(obj, EndFireAndForget, callback);
1286 } 1286 }
1287 } 1287 }*/
1288 1288
1289 public static void FireAndForget(System.Threading.WaitCallback callback) 1289 public static void FireAndForget(System.Threading.WaitCallback callback)
1290 { 1290 {
1291 FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>(); 1291 //FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
1292 wrapper.FireAndForget(callback); 1292 //wrapper.FireAndForget(callback);
1293 System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, null);
1293 } 1294 }
1294 1295
1295 public static void FireAndForget(System.Threading.WaitCallback callback, object obj) 1296 public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
1296 { 1297 {
1297 FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>(); 1298 //FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
1298 wrapper.FireAndForget(callback, obj); 1299 //wrapper.FireAndForget(callback, obj);
1300 System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, obj);
1299 } 1301 }
1300 1302
1301 private static void EndFireAndForget(IAsyncResult ar) 1303 /*private static void EndFireAndForget(IAsyncResult ar)
1302 { 1304 {
1303 System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState; 1305 System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState;
1304 1306
@@ -1306,7 +1308,7 @@ namespace OpenSim.Framework
1306 catch (Exception ex) { m_log.Error("[UTIL]: Asynchronous method threw an exception: " + ex.Message, ex); } 1308 catch (Exception ex) { m_log.Error("[UTIL]: Asynchronous method threw an exception: " + ex.Message, ex); }
1307 1309
1308 ar.AsyncWaitHandle.Close(); 1310 ar.AsyncWaitHandle.Close();
1309 } 1311 }*/
1310 1312
1311 #endregion FireAndForget Threading Pattern 1313 #endregion FireAndForget Threading Pattern
1312 } 1314 }