Given bs
, an instance of com.google.protobuf.ByteString
.
What is the best way to parse from it
I have tried
- Foo.parseFrom(bs.toByteArray)
- Foo.parseFrom(bs.newInput)
Surprisingly, a JMH benchmark shows that 1. is faster (I would have expected to avoid instantiating a new array with 2.).
Is there a better way ?