adriancole commented on issue #2579: Benchmark bytes / bytebuffer, protobuf vs 
zipkin vs wire.
URL: https://github.com/apache/incubator-zipkin/pull/2579#issuecomment-491282385
 
 
   I'll revise what I said above @anuraaga has in the bench setup is fairly 
realistic as the bytebuffer isn't a cover for a byte array.
   
   However, like Rag said, google's library is peeking and using Unsafe under 
the covers. I'm not sure Okio does that (or assumes it could).
   
   Specifically, google's returns 
[CodedInputStream.UnsafeDirectNioDecoder](https://github.com/protocolbuffers/protobuf/blob/5b232b8ecbce13286be09e703997e887ae0d464d/java/core/src/main/java/com/google/protobuf/CodedInputStream.java#L1278)
   
   ```java
     static CodedInputStream newInstance(ByteBuffer buf, boolean 
bufferIsImmutable) {
       if (buf.hasArray()) {
         return newInstance(buf.array(), buf.arrayOffset() + buf.position(), 
buf.remaining(), bufferIsImmutable);
       } else if (buf.isDirect() && 
CodedInputStream.UnsafeDirectNioDecoder.isSupported()) {
         return new CodedInputStream.UnsafeDirectNioDecoder(buf, 
bufferIsImmutable);
       } else {
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to