I am a protocol buffer newbie. 
I have inherited a performance-critical application that reads some 
high-volume data streams that are coded in protocol buffer format. 

byte[] org.google.protobuf.CodedInputStream.readRawBytes(int size)
allocates a new byte[size] from the heap on every call. 

I want to avoid this heap allocation. 

There is no method that allows one to pass in their own byte[] buf to avoid 
allocating a new byte[size] from a the heap on each invocation. 

In addition, the class is declared final ... which prevents one from 
deriving a subclass and implementing readRawBytes(int size, byte[] buf)

This prevents me from adding this "heap friendly" change without cloning & 
modifying the source code. 

Q: Am I missing something? 

Q: What was the thinking/rationale behind these design decisions? 


Thanks,
Michael

-- 
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/groups/opt_out.


Reply via email to