Refine profiler, improve fluid performance
The fluid improvements reduce the number of scheduled updates queued during terrain generation (they are not really very necessary).
This commit is contained in:
parent
08c313a651
commit
988d2077a2
@ -69,6 +69,8 @@ namespace TrueCraft.Core.Logic.Blocks
|
|||||||
|
|
||||||
public void ScheduleNextEvent(Coordinates3D coords, IWorld world, IMultiplayerServer server)
|
public void ScheduleNextEvent(Coordinates3D coords, IWorld world, IMultiplayerServer server)
|
||||||
{
|
{
|
||||||
|
if (world.GetBlockID(coords) == StillID)
|
||||||
|
return;
|
||||||
var chunk = world.FindChunk(coords);
|
var chunk = world.FindChunk(coords);
|
||||||
server.Scheduler.ScheduleEvent("fluid", chunk,
|
server.Scheduler.ScheduleEvent("fluid", chunk,
|
||||||
TimeSpan.FromSeconds(SecondsBetweenUpdates), (_server) =>
|
TimeSpan.FromSeconds(SecondsBetweenUpdates), (_server) =>
|
||||||
|
@ -42,7 +42,7 @@ namespace TrueCraft.Profiling
|
|||||||
{
|
{
|
||||||
ActiveTimers.Push(new ActiveTimer
|
ActiveTimers.Push(new ActiveTimer
|
||||||
{
|
{
|
||||||
Started = Stopwatch.ElapsedMilliseconds,
|
Started = Stopwatch.ElapsedTicks,
|
||||||
Finished = -1,
|
Finished = -1,
|
||||||
Bucket = bucket
|
Bucket = bucket
|
||||||
});
|
});
|
||||||
@ -54,12 +54,13 @@ namespace TrueCraft.Profiling
|
|||||||
if (ActiveTimers.Count > 0)
|
if (ActiveTimers.Count > 0)
|
||||||
{
|
{
|
||||||
var timer = ActiveTimers.Pop();
|
var timer = ActiveTimers.Pop();
|
||||||
timer.Finished = Stopwatch.ElapsedMilliseconds;
|
timer.Finished = Stopwatch.ElapsedTicks;
|
||||||
for (int i = 0; i < EnabledBuckets.Count; i++)
|
for (int i = 0; i < EnabledBuckets.Count; i++)
|
||||||
{
|
{
|
||||||
if (Match(EnabledBuckets[i], timer.Bucket))
|
if (Match(EnabledBuckets[i], timer.Bucket))
|
||||||
{
|
{
|
||||||
Console.WriteLine("{0} took {1}ms", timer.Bucket, timer.Finished - timer.Started);
|
Console.WriteLine("{0} took {1}ms", timer.Bucket,
|
||||||
|
(timer.Finished - timer.Started) / 10000.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user