Give neighbour block updates its own timer

this way we aren't conflating them with scheduled updates, which are usually caused by e.g. water
This commit is contained in:
Dylan K. Taylor 2023-10-23 12:33:36 +01:00
parent 41c5f63565
commit af432c1a7f
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 5 additions and 3 deletions

View File

@ -948,9 +948,7 @@ class World implements ChunkManager{
$this->providerGarbageCollectionTicker = 0;
}
//Do block updates
$this->timings->scheduledBlockUpdates->startTiming();
//Delayed updates
while($this->scheduledBlockUpdateQueue->count() > 0 && $this->scheduledBlockUpdateQueue->current()["priority"] <= $currentTick){
/** @var Vector3 $vec */
@ -962,7 +960,9 @@ class World implements ChunkManager{
$block = $this->getBlock($vec);
$block->onScheduledUpdate();
}
$this->timings->scheduledBlockUpdates->stopTiming();
$this->timings->neighbourBlockUpdates->startTiming();
//Normal updates
while($this->neighbourBlockUpdateQueue->count() > 0){
$index = $this->neighbourBlockUpdateQueue->dequeue();
@ -987,7 +987,7 @@ class World implements ChunkManager{
$block->onNearbyBlockChange();
}
$this->timings->scheduledBlockUpdates->stopTiming();
$this->timings->neighbourBlockUpdates->stopTiming();
$this->timings->entityTick->startTiming();
//Update entities that need update

View File

@ -34,6 +34,7 @@ class WorldTimings{
public TimingsHandler $doChunkUnload;
public TimingsHandler $scheduledBlockUpdates;
public TimingsHandler $neighbourBlockUpdates;
public TimingsHandler $randomChunkUpdates;
public TimingsHandler $randomChunkUpdatesChunkSelection;
public TimingsHandler $doChunkGC;
@ -77,6 +78,7 @@ class WorldTimings{
$this->doChunkUnload = self::newTimer($name, "Unload Chunks");
$this->scheduledBlockUpdates = self::newTimer($name, "Scheduled Block Updates");
$this->neighbourBlockUpdates = self::newTimer($name, "Neighbour Block Updates");
$this->randomChunkUpdates = self::newTimer($name, "Random Chunk Updates");
$this->randomChunkUpdatesChunkSelection = self::newTimer($name, "Random Chunk Updates - Chunk Selection");
$this->doChunkGC = self::newTimer($name, "Garbage Collection");