mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Chunk: be more intelligent about fast-serializing chunks
This reduces the amount of useless data that pthreads has to copy around.
This commit is contained in:
@ -222,23 +222,6 @@ class SubChunk implements SubChunkInterface{
|
||||
return "\x00" . $this->ids . $this->data;
|
||||
}
|
||||
|
||||
public function fastSerialize() : string{
|
||||
return
|
||||
$this->ids .
|
||||
$this->data .
|
||||
$this->skyLight .
|
||||
$this->blockLight;
|
||||
}
|
||||
|
||||
public static function fastDeserialize(string $data) : SubChunk{
|
||||
return new SubChunk(
|
||||
substr($data, 0, 4096), //ids
|
||||
substr($data, 4096, 2048), //data
|
||||
substr($data, 6144, 2048), //sky light
|
||||
substr($data, 8192, 2048) //block light
|
||||
);
|
||||
}
|
||||
|
||||
public function __debugInfo(){
|
||||
return [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user