pjfanning commented on code in PR #1135:
URL: https://github.com/apache/pekko-http/pull/1135#discussion_r3529549083
##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/PerMessageDeflate.scala:
##########
@@ -275,15 +275,15 @@ private[http] object PerMessageDeflate {
}
private def deflate(data: ByteString, removeTail: Boolean): ByteString = {
- deflater.setInput(data.toArray)
- val output = new ByteArrayOutputStream()
+ deflater.setInput(data.toArrayUnsafe())
+ val output = new ByteArrayOutputStream(1024)
Review Comment:
ByteArrayOutputStream starts with 32 bytes by default and you can end up
allocating multiple new arrays while you grow the data. Starting with a
reasonable value can help.
--
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]