Hi etorri,

Embedded messages and strings have the exact same wire format.  When parsing
a message, it's impossible to know whether you're parsing one or the other,
and since strings have to be encoded using their length in bytes, we can't
do something different for embedded messages.

Cheers,
Alek

On Tue, Jun 23, 2009 at 9:06 AM, etorri <e...@torri.be> wrote:

>
>
> Hello,
>
> The "length delimited" encoding basically tells that the following N
> bytes belong to this field. Wouldn't it be easier to instead use the
> number of elements that belong to the embedded message (repeated
> element).
>
> Now (as far as I have understood) the message needs to be built from
> fragments and then collected together as the lengths are not known
> beforehand and it would be expensive to calculate the byte-length of
> the embedded message.
>
> Instead, it would be relatively inexpensive to calculate just the
> number of following elements that make the embedded message before
> starting to encode it.
>
> This would enable streaming of PB or encoding and sending the elements
> right as they are encoded.
>
> Sorry if I misunderstood something. I have just started looking at BP.
> >
>


-- 
Alek Storm

--~--~---------~--~----~------------~-------~--~----~
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