
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.
16 lines
358 B
Java
16 lines
358 B
Java
package org.bukkit.craftbukkit.util;
|
|
|
|
public class LongHash {
|
|
public static long toLong(int msw, int lsw) {
|
|
return ((long) msw << 32) + lsw - Integer.MIN_VALUE;
|
|
}
|
|
|
|
public static int msw(long l) {
|
|
return (int) (l >> 32);
|
|
}
|
|
|
|
public static int lsw(long l) {
|
|
return (int) (l & 0xFFFFFFFF) + Integer.MIN_VALUE;
|
|
}
|
|
}
|