scwhittle commented on code in PR #36742:
URL: https://github.com/apache/beam/pull/36742#discussion_r2502397045


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/ThreadLocalByteStringOutputStream.java:
##########
@@ -36,27 +35,44 @@ public class ThreadLocalByteStringOutputStream {
   // Private constructor to prevent instantiations from outside.
   private ThreadLocalByteStringOutputStream() {}
 
+  /** @return An AutoClosable StreamHandle that holds a cached 
ByteStringOutputStream. */
+  public static StreamHandle acquire() {
+    return new StreamHandle();

Review Comment:
   I think you could avoid allocation by caching the StreamHandle in RefHolder 
(or making RefHolder implement StreamHandle interface) for the case it's not 
inUse . If it is inUse you can have separate impl that requires allocation



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to