mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 23:07:40 +01:00
Setting the cache is important to access a cache
This commit is contained in:
parent
fb05841421
commit
97e083b9b0
@ -4,8 +4,7 @@ Date: Thu, 27 Aug 2015 01:15:02 -0400
|
||||
Subject: [PATCH] Optimize Chunk Access
|
||||
|
||||
getting a loaded chunk is one of the most hottest pieces of code in the game.
|
||||
Often, getChunkAt is called for the same chunk multiple times in a row, often
|
||||
from getType();
|
||||
getChunkAt is called for the same chunk multiple times in a row, often from getType();
|
||||
|
||||
Optimize this look up by using a Last Access cache.
|
||||
|
||||
@ -46,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (lastChunkByPos != null && key == lastChunkByPos.chunkKey) {
|
||||
+ return lastChunkByPos;
|
||||
+ }
|
||||
+ return super.get(key);
|
||||
+ return lastChunkByPos = super.get(key);
|
||||
+ }
|
||||
+ }; // CraftBukkit
|
||||
+ // Paper end
|
||||
|
Loading…
Reference in New Issue
Block a user