diff options
author | UbitUmarov | 2016-08-24 06:26:31 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-24 06:26:31 +0100 |
commit | 32396742f86fb5336de5acd4e2a05099f111022a (patch) | |
tree | c371779ba84e60c26acc0a4e1300338912cc0483 /OpenSim/Framework | |
parent | dont request a workjob if we can see there is nothing to do (diff) | |
download | opensim-SC-32396742f86fb5336de5acd4e2a05099f111022a.zip opensim-SC-32396742f86fb5336de5acd4e2a05099f111022a.tar.gz opensim-SC-32396742f86fb5336de5acd4e2a05099f111022a.tar.bz2 opensim-SC-32396742f86fb5336de5acd4e2a05099f111022a.tar.xz |
reduce unnecessary allocation of new items
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 8787ea0..008127e 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -361,8 +361,8 @@ namespace OpenSim.Framework.Monitoring | |||
361 | /// <returns></returns> | 361 | /// <returns></returns> |
362 | public static bool RegisterStat(Stat stat) | 362 | public static bool RegisterStat(Stat stat) |
363 | { | 363 | { |
364 | SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory; | 364 | SortedDictionary<string, SortedDictionary<string, Stat>> category = null; |
365 | SortedDictionary<string, Stat> container = null, newContainer; | 365 | SortedDictionary<string, Stat> container = null; |
366 | 366 | ||
367 | lock (RegisteredStats) | 367 | lock (RegisteredStats) |
368 | { | 368 | { |
@@ -375,19 +375,15 @@ namespace OpenSim.Framework.Monitoring | |||
375 | // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. | 375 | // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. |
376 | // This means that we don't need to lock or copy them on iteration, which will be a much more | 376 | // This means that we don't need to lock or copy them on iteration, which will be a much more |
377 | // common operation after startup. | 377 | // common operation after startup. |
378 | if (container != null) | 378 | if (container == null) |
379 | newContainer = new SortedDictionary<string, Stat>(container); | 379 | container = new SortedDictionary<string, Stat>(); |
380 | else | ||
381 | newContainer = new SortedDictionary<string, Stat>(); | ||
382 | 380 | ||
383 | if (category != null) | 381 | if (category == null) |
384 | newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category); | 382 | category = new SortedDictionary<string, SortedDictionary<string, Stat>>(); |
385 | else | ||
386 | newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(); | ||
387 | 383 | ||
388 | newContainer[stat.ShortName] = stat; | 384 | container[stat.ShortName] = stat; |
389 | newCategory[stat.Container] = newContainer; | 385 | category[stat.Container] = container; |
390 | RegisteredStats[stat.Category] = newCategory; | 386 | RegisteredStats[stat.Category] = category; |
391 | } | 387 | } |
392 | 388 | ||
393 | return true; | 389 | return true; |