adriancole commented on a change in pull request #2582: Reuse char[] buffer 
when decoding hex fields.
URL: https://github.com/apache/incubator-zipkin/pull/2582#discussion_r283085282
 
 

 ##########
 File path: benchmarks/src/main/java/zipkin2/codec/WireSpanDecoder.java
 ##########
 @@ -279,8 +280,34 @@ public static Span decodeOne(ProtoReader input) throws 
IOException {
     return spans;
   }
 
+  static final char[] HEX_DIGITS =
+    {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 
'e', 'f'};
+
+  // Reuse the buffer for decoding into hex since it's immediately copied into 
a String.
+  static final ThreadLocal<char[]> THIRTY_TWO_CHARS = new 
ThreadLocal<char[]>() {
+    @Override protected char[] initialValue() {
+      return new char[32];
+    }
+  };
+
   private static String readHexString(ProtoReader input) throws IOException {
 
 Review comment:
   ```suggestion
     // https://github.com/square/wire/issues/958
     private static String readHexString(ProtoReader input) throws IOException {
   ```

----------------------------------------------------------------
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