Potentially dramatically reduce CPU usage at the cost of 1 megabytes of ram across the entire Bungee instance.

This commit is contained in:
md_5 2013-01-24 20:27:26 +11:00
parent 12eff81843
commit 684600a423

View File

@ -25,12 +25,12 @@ abstract class Instruction {
static final Instruction USHORT_BYTE = new UnsignedShortByte(); static final Instruction USHORT_BYTE = new UnsignedShortByte();
// Illegal forward references below this line // Illegal forward references below this line
static final Instruction BYTE_INT = new ByteHeader(INT); static final Instruction BYTE_INT = new ByteHeader(INT);
// Buffer used to read all skips, make sure it is sufficiently large (1mb packet at the moment)
static final byte[] buf = new byte[1 << 20];
abstract void read(DataInput in) throws IOException; abstract void read(DataInput in) throws IOException;
final void skip(DataInput in, int len) throws IOException { final void skip(DataInput in, int len) throws IOException {
for (int i = 0; i < len; i++) { in.readFully(buf, 0, len);
in.readUnsignedByte();
}
} }
} }