Add LongObjectHashMap and LongHashSet

Replace uses of LongHashtable and LongHashset with new implementations.
Remove EntryBase, LongBaseHashtable, LongHashset, and LongHashtable as they
are no longer used.

LongObjectHashMap does not use Entry or EntryBase classes internally for
storage so has much lower object churn and greater performance. LongHashSet
is not as much of performance win for our use case but for general use is
up to seventeen times faster than the old implementation and is in fact
faster than alternatives from "high performance" java libraries. This is
being added so that if someone tries to use it in the future in a place
unrelated to its current use they don't accidentally end up with something
slower than the Java collections HashSet implementation.
This commit is contained in:
Travis Watkins
2012-08-17 18:53:59 -05:00
parent 7b20caf8fe
commit 97ac0a3f14
10 changed files with 866 additions and 404 deletions

View File

@@ -11,20 +11,20 @@ import java.util.Set;
import java.util.Random;
import org.bukkit.Server;
import org.bukkit.craftbukkit.util.LongHashset;
import org.bukkit.craftbukkit.util.LongHashtable;
import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.craftbukkit.util.LongObjectHashMap;
import org.bukkit.event.world.ChunkUnloadEvent;
// CraftBukkit end
public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit start
public LongHashset unloadQueue = new LongHashset();
public LongHashSet unloadQueue = new LongHashSet();
public Chunk emptyChunk;
public IChunkProvider chunkProvider; // CraftBukkit
private IChunkLoader e;
public boolean forceChunkLoad = false; // true -> false
public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
public List chunkList = new ArrayList();
public WorldServer world;
// CraftBukkit end