This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new fb1850ba2 Reduce buffer size for ASCII string optimization to 63 bytes
(#3279)
fb1850ba2 is described below
commit fb1850ba2793fbe49b5918671e5f4f48e335ff76
Author: belugabehr <[email protected]>
AuthorDate: Mon Feb 3 03:24:45 2025 -0500
Reduce buffer size for ASCII string optimization to 63 bytes (#3279)
---
.../java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
index f8f9802ed..97d9895c7 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
@@ -37,8 +37,12 @@ import org.apache.avro.util.Utf8;
*/
public abstract class BinaryEncoder extends Encoder {
- // Buffer used for writing ASCII strings
- private final byte[] stringBuffer = new byte[128];
+ /*
+ * Buffer used for writing ASCII strings. A string is encoded as a long
followed
+ * by that many bytes of character data. A string of length 63 is the upper
+ * limit for a 1 byte variable-length long value.
+ */
+ private final byte[] stringBuffer = new byte[63];
@Override
public void writeNull() throws IOException {