From 520077f254b12175a1eafa23a41aad657b614329 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 16 Jun 2014 19:01:55 -0500 Subject: [PATCH] Avoid checking for loaded chunks for lighting and entity ticking. When a chunk is loaded the server tries to ensure it has its initial light calculations done before sending it to the player. When ticking entities the server tries to ensure the entity does not walk into an unloaded chunk. To accomplish these the server checks a one chunk radius around the chunk to be lit or a two chunk radius around the chunk the entity is in. These lookups happen every tick even though their result is unlikely to change that often. To reduce the cost of these checks we replace them with a system to keep track of what neighbor chunks a chunk has loaded and update it when chunks load or unload which is a much less frequent action. On a server with ten players this change removes about 100,000 calls a tick to LongObjectHashMap's containsKey method. By: Travis Watkins --- .../craftbukkit/chunkio/ChunkIOProvider.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/paper-server/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java index 8feadd112a..1440349b96 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -28,7 +28,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider