I understand, but if one wants to keep a large persistent message allocated
and walk over it frequently, there is a price to pay on cache misses that
can be significant.

In my situation I am maintaining a large persistent instance of a large
message type that I used as a cached data set to compare runtime data with,
and if it has changed, I want to re-send the parent message with only the
changed bits across the network. This frequent operation can benefit from
locality of reference if there was an option to generate the code
statically, so that every lookup into the message doesn't have to involve a
cache miss.


On Tue, Jul 17, 2012 at 1:30 PM, Evan Jones <ev...@csail.mit.edu> wrote:

> On Jul 17, 2012, at 2:33 , Jeremy Swigart wrote:
> > Is there a way to tell the proto compiler to generate message
> definitions for which the message fields are statically defined rather than
> each individual field allocated with dynamic memory? Obviously the repeater
> fields couldn't be fully statically allocated(unless you could provide the
> compiler with a max size), but it would be preferable to have the option to
> create messages with minimal dynamic memory impact. Is this possible in the
> current library?
>
> I'll assume you are talking C++. In this case, if you re-use a single
> message, it will re-use the dynamically allocated memory. This means that
> after the "maximal" message(s) have been parsed, it will no longer allocate
> memory. This is approximately equivalent to what you want. See Optimization
> Tips in:
>
> https://developers.google.com/protocol-buffers/docs/cpptutorial
>
> Hope that helps,
>
> Evan
>
> --
> http://evanjones.ca/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to