mdedetrich commented on code in PR #146:
URL: 
https://github.com/apache/incubator-pekko-connectors/pull/146#discussion_r1224053810


##########
json-streaming/src/main/scala/org/apache/pekko/stream/connectors/json/impl/JsonStreamReader.scala:
##########
@@ -69,8 +69,8 @@ private[pekko] final class JsonStreamReader(path: JsonPath) 
extends GraphStage[F
         }
 
         if (buffer.nonEmpty) {
-          emitMultiple(out, buffer)
-          buffer = Queue.empty[ByteString]
+          emitMultiple(out, buffer.toSeq.iterator)

Review Comment:
   So I just noticed this now and I am thinking that the 
`List(ByteString(value.toString))` variant is better because while there may be 
a trivial box for a single `List` (which might get inlined anyways), the 
`buffer.toSeq.iterator` is basically going to copy the entire collection which 
is much worse especially considering that the size of this collection can be 
quite large
   
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to