New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache byte[] for the last 64 tags #1533
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, configuration would be good.
@@ -107,7 +126,21 @@ private static void writeUTF8Tag(final String value, final MessagePacker destina | |||
destination.packRawStringHeader(interned.length); | |||
destination.addPayload(interned); | |||
} else { | |||
destination.packString(value); | |||
byte[] bytes = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I see misunderstood. This is covering the value. Nice.
// Something went wrong. We will write out the string the normal way. | ||
} | ||
} | ||
if (bytes != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would this ever be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the string is ""
or if the tagCache.get
throws an exception.
This removes roughly
30%
of allbyte[]
allocations and70%
of allsun.nio.cs.UTF_8$Encoder
allocations during apet-clinic
run.Not sure about the cache size.