Comment #8 on issue 429 by [email protected]: Support ByteBuffer in
CodedInputStream and CodedOutputStream to avoid redundant copies for direct
ByteBuffer.
http://code.google.com/p/protobuf/issues/detail?id=429
We tried to implement a CodedInputStream which reads directly from a direct
ByteBuffer but it turns out to make the parsing performance worse (i.e.,
copy the whole content to byte[] then parsing from byte[] is better than
parsing from ByteBuffer directly). The fact is, ByteBuffer.get() is several
times slower then byte[i] and as in protobuf we do a lot of varint decoding
(which reads byte by byte), making a copy to byte[] gives us the better
performance in almost all cases.
As a result we are not pursing avoiding this seemingly "redundant copy" in
CodedInputStream. If you have a particular proto which only contains
several large bytes field, wrapping the ByteBuffer in an InputStream might
work better for you. But for general use, the current implementation should
be the right approach.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups "Protocol
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.