mdedetrich commented on code in PR #1247: URL: https://github.com/apache/pekko/pull/1247#discussion_r1552948771
########## actor/src/main/scala-2.12/org/apache/pekko/util/ByteString.scala: ########## @@ -790,6 +843,30 @@ sealed abstract class ByteString extends IndexedSeq[Byte] with IndexedSeqOptimiz // optimized in subclasses override def indexOf[B >: Byte](elem: B): Int = indexOf(elem, 0) + // optimized version of indexOf for bytes, optimized in subclasses + /** + * Finds index of first occurrence of some byte in this ByteString after or at some start index. + * + * Similar to indexOf, but it avoids boxing if the value is already a byte. + * + * @param elem the element value to search for. + * @param from the start index + * @return the index `>= from` of the first element of this ByteString that is equal (as determined by `==`) + * to `elem`, or `-1`, if none exists. + */ + def indexOf(elem: Byte, from: Int): Int = indexOf(elem, from) Review Comment: > The Pekko ByteString is not going away soon. The idea that it will end up in the Scala lib is not gaining traction and even it does it may not end up in every Scala version that Pekko needs it in and it may end up working differently to the way the Pekko one does. It dis a really gain traction, it's just like qith most things you need to drive it yourself (others won't do it for you) and I didn't have the capacity with all of the other Pekko stuff going on There is still a lot of merit in Pekko using an eventually stdlib `ByteString` but this will happen in a major breaking change in Pekko and it shouldn't dictate the development of Pekko. -- 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]
