mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
LightUpdate::execute() now returns the number of visits made to blocks in total
this is useful for performance profiling.
This commit is contained in:
parent
15299735e9
commit
94d8f59484
@ -129,10 +129,12 @@ abstract class LightUpdate{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute() : void{
|
public function execute() : int{
|
||||||
$this->prepareNodes();
|
$this->prepareNodes();
|
||||||
|
|
||||||
|
$touched = 0;
|
||||||
while(!$this->removalQueue->isEmpty()){
|
while(!$this->removalQueue->isEmpty()){
|
||||||
|
$touched++;
|
||||||
list($x, $y, $z, $oldAdjacentLight) = $this->removalQueue->dequeue();
|
list($x, $y, $z, $oldAdjacentLight) = $this->removalQueue->dequeue();
|
||||||
|
|
||||||
$points = [
|
$points = [
|
||||||
@ -155,6 +157,7 @@ abstract class LightUpdate{
|
|||||||
}
|
}
|
||||||
|
|
||||||
while(!$this->spreadQueue->isEmpty()){
|
while(!$this->spreadQueue->isEmpty()){
|
||||||
|
$touched++;
|
||||||
list($x, $y, $z) = $this->spreadQueue->dequeue();
|
list($x, $y, $z) = $this->spreadQueue->dequeue();
|
||||||
|
|
||||||
unset($this->spreadVisited[World::blockHash($x, $y, $z)]);
|
unset($this->spreadVisited[World::blockHash($x, $y, $z)]);
|
||||||
@ -179,6 +182,8 @@ abstract class LightUpdate{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $touched;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function computeRemoveLight(int $x, int $y, int $z, int $oldAdjacentLevel) : void{
|
protected function computeRemoveLight(int $x, int $y, int $z, int $oldAdjacentLevel) : void{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user