You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2024/05/16 19:29:33 UTC
[PR] s3: avoid array copies when dealing with ByteStrings [pekko-connectors]
pjfanning opened a new pull request, #658:
URL: https://github.com/apache/pekko-connectors/pull/658
the 'unsafe' methods are ok if you know the data is not being mutated
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] s3: avoid array copies when dealing with ByteStrings [pekko-connectors]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #658:
URL: https://github.com/apache/pekko-connectors/pull/658#issuecomment-2116044906
@mdedetrich You are the most active contributor to the S3 code base. Do these changes look ok to you?
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] s3: avoid array copies when dealing with ByteStrings [pekko-connectors]
Posted by "laglangyue (via GitHub)" <gi...@apache.org>.
laglangyue commented on PR #658:
URL: https://github.com/apache/pekko-connectors/pull/658#issuecomment-2121818403
lgtm
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] s3: avoid array copies when dealing with ByteStrings [pekko-connectors]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #658:
URL: https://github.com/apache/pekko-connectors/pull/658
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] s3: avoid array copies when dealing with ByteStrings [pekko-connectors]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #658:
URL: https://github.com/apache/pekko-connectors/pull/658#discussion_r1603949208
##########
s3/src/main/scala/org/apache/pekko/stream/connectors/s3/impl/auth/package.scala:
##########
@@ -36,7 +36,16 @@ package object auth {
new String(out)
}
- @InternalApi private[impl] def encodeHex(bytes: ByteString): String = encodeHex(bytes.toArray)
+ @InternalApi private[impl] def encodeHex(bytes: ByteString): String = {
+ val length = bytes.length
Review Comment:
looking at the ByteStrings code (complex ByteString made up of underlying ByteStrings) the apply(Int) function and the iterator function are not performant.
https://github.com/apache/pekko/blob/c4805f1839ead0cfe31700d6c41928df9fb1056d/actor/src/main/scala-3/org/apache/pekko/util/ByteString.scala#L554-L570
So I'm now thinking of changing this to
```
def encodeHex(bytes: ByteString): String = encodeHex(bytes.toArrayUnsafe)
```
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] s3: avoid array copies when dealing with ByteStrings [pekko-connectors]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #658:
URL: https://github.com/apache/pekko-connectors/pull/658#discussion_r1603942195
##########
s3/src/main/scala/org/apache/pekko/stream/connectors/s3/impl/auth/package.scala:
##########
@@ -36,7 +36,16 @@ package object auth {
new String(out)
}
- @InternalApi private[impl] def encodeHex(bytes: ByteString): String = encodeHex(bytes.toArray)
+ @InternalApi private[impl] def encodeHex(bytes: ByteString): String = {
+ val length = bytes.length
Review Comment:
ByteString implements `IndexedSeq[Byte]` so we can iterate it without converting it to an array.
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org