Skip to content

Commit

Permalink
Inline function calls in hot path
Browse files Browse the repository at this point in the history
  • Loading branch information
oneonestar authored and sopel39 committed Jan 11, 2024
1 parent 2f3453b commit 87ea350
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public void deserialize(LineBuffer lineBuffer, PageBuilder builder)
throws IOException
{
builder.declarePosition();
Slice line = Slices.wrappedBuffer(lineBuffer.getBuffer(), 0, lineBuffer.getLength());
byte[] buffer = lineBuffer.getBuffer();
Slice line = Slices.wrappedBuffer(buffer, 0, lineBuffer.getLength());

int offset = 0;
int length = line.length();
Expand All @@ -90,7 +91,7 @@ public void deserialize(LineBuffer lineBuffer, PageBuilder builder)
int elementOffset = offset;
int fieldIndex = 0;
while (offset < end) {
byte currentByte = line.getByte(offset);
byte currentByte = buffer[offset];
if (currentByte == separator) {
decodeElementValueInto(fieldIndex, builder, line, elementOffset, offset - elementOffset);
elementOffset = offset + 1;
Expand All @@ -100,7 +101,7 @@ public void deserialize(LineBuffer lineBuffer, PageBuilder builder)
break;
}
}
else if (isEscapeByte(currentByte)) {
else if (escapeByte != null && currentByte == escapeByte) {
// ignore the char after escape_char
offset++;
}
Expand Down Expand Up @@ -143,9 +144,4 @@ private boolean isNullSequence(Slice slice, int offset, int length)
{
return nullSequence.equals(0, nullSequence.length(), slice, offset, length);
}

private boolean isEscapeByte(byte currentByte)
{
return escapeByte != null && currentByte == escapeByte;
}
}

0 comments on commit 87ea350

Please sign in to comment.