adriancole commented on a change in pull request #2588: Consolidates buffers 
and generally improves string decoding
URL: https://github.com/apache/incubator-zipkin/pull/2588#discussion_r283128512
 
 

 ##########
 File path: zipkin/src/main/java/zipkin2/internal/UnsafeBuffer.java
 ##########
 @@ -98,19 +98,33 @@ public void reset() {
 
   String readUtf8(int length) {
     require(length);
-    String result = new String(buf, pos, length, UTF_8);
+    String result = maybeDecodeShortAsciiString(buf, pos, length);
+    if (result == null) result = new String(buf, pos, length, UTF_8);
     pos += length;
     return result;
   }
 
+  // Speculatively assume all 7-bit ASCII characters.. common in normal tags 
and names
+  @Nullable static String maybeDecodeShortAsciiString(byte[] buf, int offset, 
int length) {
 
 Review comment:
   this method made the most difference, but no I didn't test it independently 
of decoding spans

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to