pjfanning commented on code in PR #829:
URL: https://github.com/apache/pekko-http/pull/829#discussion_r2420111864
##########
http-core/src/main/scala-2.13/org/apache/pekko/http/impl/engine/package.scala:
##########
@@ -36,17 +37,29 @@ package object parsing {
case x => x.toString
}
+ /**
+ * Like `byteChar` but doesn't throw `NotEnoughDataException` if the index
is out of bounds.
+ * Used in places where we know that the index is valid because we checked
the length beforehand.
+ */
+ @inline
+ private[http] def safeByteChar(input: ByteString, ix: Int): Char =
Review Comment:
@jrudolph thanks for the review. I can look at doing a jmh benchmark but it
will take me a week or 2 to get back to it.
One question though: do you think the safeByteChar function is a useful
change instead of having a few places in our code where we do the masking in
place while usually, we call the byteChar function below? There are places
where we know it safe so that we don't need to waste a call on checking the
index is in bounds.
--
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]