BELUGA BEHR created AVRO-2056:
---------------------------------
Summary: DirectBinaryEncoder Creates Buffer For Each Call To
writeDouble
Key: AVRO-2056
URL: https://issues.apache.org/jira/browse/AVRO-2056
Project: Avro
Issue Type: Improvement
Components: java
Reporter: BELUGA BEHR
Priority: Minor
Each call to {{writeDouble}} creates a new buffer and promptly throws it away
even though the class has a re-usable buffer and is used in other methods such
as {{writeFloat}}. Remove this extra buffer.
{code:title=org.apache.avro.io.DirectBinaryEncoder}
// the buffer is used for writing floats, doubles, and large longs.
private final byte[] buf = new byte[12];
@Override
public void writeFloat(float f) throws IOException {
int len = BinaryData.encodeFloat(f, buf, 0);
out.write(buf, 0, len);
}
@Override
public void writeDouble(double d) throws IOException {
byte[] buf = new byte[8];
int len = BinaryData.encodeDouble(d, buf, 0);
out.write(buf, 0, len);
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)