use of org.nustaq.offheap.structs.FSTStructAllocator in project fast-cast by RuedigerMoeller.
the class Protocol method main.
public static void main(String[] s) {
initStructFactory();
PriceUpdateStruct template = new PriceUpdateStruct();
FSTStructAllocator onHeapAlloc = new FSTStructAllocator(0);
// speed up instantiation by moving template also off heap
template = onHeapAlloc.newStruct(template);
// demonstrates that theoretical send rate is >20 millions messages per second on
// an I7 box
byte[] networkBuffer = new byte[template.getByteSize()];
PriceUpdateStruct msg = onHeapAlloc.newStruct(template);
int sizeOf = msg.getByteSize();
while (true) {
do20Millions(networkBuffer, msg, sizeOf);
}
// System.out.println(msg);
// System.out.println("size:" + msg.getByteSize());
}
Aggregations