Sorry, I just stumbled across HADOOP-6109 which made this change in trunk, I was looking at the Text in 1.0.2. Cant get this fix get backported to the Hadoop 1 versions?

On 04/24/2012 11:01 PM, Jim Donofrio wrote:
private void setCapacity(int len, boolean keepData) {
if (bytes == null || bytes.length < len) {
byte[] newBytes = new byte[len];
if (bytes != null && keepData) {
System.arraycopy(bytes, 0, newBytes, 0, length);
}
bytes = newBytes;
}
}

Why does Text.setCapacity only expand the array to the length of the new
data? Why not instead set the length to double the new requested length
or 3/2 times the existing length as in ArrayList so that the array size
will grow exponentially as in most dynamic array implentations?

Reply via email to