Author: trustin
Date: 2009-11-20 10:05:02 -0500 (Fri, 20 Nov 2009)
New Revision: 8344
Modified:
branches/20-optimisation/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java
Log:
Added the markers which points to the location where additional performance tuning could
be done
Modified:
branches/20-optimisation/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java
===================================================================
---
branches/20-optimisation/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java 2009-11-20
15:03:21 UTC (rev 8343)
+++
branches/20-optimisation/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java 2009-11-20
15:05:02 UTC (rev 8344)
@@ -48,7 +48,8 @@
if (previousData.readable())
{
if (previousData.readableBytes() + in.readableBytes() < SIZE_INT) {
- append(in, 512); // Length is unknown. Bet at 512.
+ // XXX Length is unknown. Bet at 512. Tune this value.
+ append(in, 512);
return;
}
@@ -104,6 +105,9 @@
previousData.writeBytes(in, length + 4 - previousData.readableBytes());
frame = previousData;
} else {
+ // XXX Tune this value: Increasing the initial capacity of the
+ // dynamic buffer might reduce the chance of additional memory
+ // copy.
frame = ChannelBuffers.dynamicBuffer(length + 4);
frame.writeBytes(previousData, previousData.readerIndex(),
previousData.readableBytes());
frame.writeBytes(in, length + 4 - frame.writerIndex());
@@ -148,6 +152,8 @@
}
// Convert to dynamic buffer (this requires copy)
+ // XXX Tune this value: Increasing the initial capacity of the dynamic
+ // buffer might reduce the chance of additional memory copy.
ChannelBuffer frame = ChannelBuffers.dynamicBuffer(length + SIZE_INT);
frame.writeBytes(in, length + SIZE_INT);
frame.skipBytes(SIZE_INT);
Show replies by date