Reuse the line buffer between strings in PacketLineIn
commit89cdc3b713c214a8f7142ef0d0df714027ad9876
authorShawn O. Pearce <spearce@spearce.org>
Fri, 12 Feb 2010 15:00:32 +0000 (12 07:00 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 13 Mar 2010 00:10:30 +0000 (12 16:10 -0800)
tree9bd13941aef7dc6266463452f55e87200d942ec7
parentc0f093899f8c027fb4e0f4418ac19b0f8ad6be16
Reuse the line buffer between strings in PacketLineIn

When reading pkt-lines off an InputStream we are quite likely to
consume a whole group of fairly short lines in rapid succession, such
as in the have exchange that occurs in the fetch-pack/upload-pack
protocol.  Rather than allocating a throwaway buffer for each
line's raw byte sequence, reuse a buffer that is equal to the small
side-band packet size, which is 1000 bytes.  Text based pkt-lines
are required to be less than this size because many widely deployed
versions of C Git use a statically allocated array of this length.

Change-Id: Ia5c8e95b85020f7f80b6d269dda5059b092d274d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java