Skip to content

Commit feca844

Browse files
committed
Merge branch 'structured_source_benchmark' into structured_source
2 parents 9d5d04f + 9149e7a commit feca844

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

server/src/main/java/org/elasticsearch/common/io/stream/RecyclerBytesStreamOutput.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private void writeAdditionalPages(byte[] b, int offset, int length) {
114114
public void writeUTF8String(String str) throws IOException {
115115
final int charCount = str.length();
116116
if (charCount == 0) {
117-
writeVInt(0);
117+
writeByte((byte) 0);
118118
return;
119119
}
120120

@@ -138,10 +138,6 @@ public void writeUTF8String(String str) throws IOException {
138138
}
139139
}
140140

141-
/**
142-
* Fast path for writing ASCII characters. Returns true if all characters
143-
* were ASCII, false if a non-ASCII character was encountered.
144-
*/
145141
private boolean writeAsciiChars(String str, int charCount) {
146142
int charIndex = 0;
147143

@@ -157,7 +153,6 @@ private boolean writeAsciiChars(String str, int charCount) {
157153
bytesRefBytes[bytesRefOffset + currentPageOffset + i] = (byte) c;
158154
}
159155

160-
// Update positions for what we wrote
161156
currentPageOffset += charsToWrite;
162157
charIndex += charsToWrite;
163158

@@ -166,7 +161,7 @@ private boolean writeAsciiChars(String str, int charCount) {
166161
}
167162
}
168163

169-
return true; // All characters were ASCII
164+
return true;
170165
}
171166

172167
private void handleNonAsciiString(String str) throws IOException {

0 commit comments

Comments
 (0)