PerfTickLogger, reduce overhead of logging long ticks.
This commit is contained in:
committed by
Matthias Mailänder
parent
c095690619
commit
edbded8f0a
@@ -66,14 +66,13 @@ namespace OpenRA
|
||||
{
|
||||
// PERF: This is a hot path and must run with minimal added overhead, so we enumerate manually
|
||||
// to allow us to call PerfTickLogger only once per iteration in the normal case.
|
||||
var perfLogger = new PerfTickLogger();
|
||||
using (var enumerator = e.GetEnumerator())
|
||||
{
|
||||
perfLogger.Start();
|
||||
var start = PerfTickLogger.GetTimestamp();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
a(enumerator.Current);
|
||||
perfLogger.LogTickAndRestartTimer(text, enumerator.Current);
|
||||
start = PerfTickLogger.LogLongTick(start, text, enumerator.Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user