On Mon, Sep 18, 2017 at 5:39 PM, Feng Xiao <[email protected]> wrote:

>
>
> On Mon, Sep 18, 2017 at 3:13 PM, Todd Lipcon <[email protected]> wrote:
>
>> Hi folks,
>>
>> I noticed that protobuf 3.4 includes the new 'table_driven_parsing'
>> option for C++ code generation, but can't seem to find any docs about this
>> feature.
>>
>> From a quick skim of the code, it seems like the goal here is to reduce
>> the amount of per-PB generated code, and instead replace it with a generic
>> method which can parse/serialize any protobuf based on a constant table
>> indicating the field/type/class-offset mappings. My guess is the purpose
>> here is to reduce code size and thus increase instruction cache locality
>> for applications which handle either very large PBs or a large number of
>> varying PB types, and potentially to unify the dynamic and generated
>> parsing code paths.
>>
>> Is my understanding correct?
>>
> You are spot-on :)
>
> Besides what you mentioned, this table-driven approach will also allow us
> to add more specialized parser implementations (e.g., a parsing method that
> reads from char* directly without a wrapping CodedInputStream, or maybe
> support an entirely different wire format for better performance in some
> specific context) without causing code bloat.
>
>
>
>> Is there any speed benefit to using table-driven parsing for applications
>> which deal with a relatively smaller set of unique PB types? Would be
>> interested to hear about experiences at Google or elsewhere with this new
>> option.
>>
> It's still highly experimental and I would not recommend using this option
> at the moment (unless you want to improve and contribute code to this
> implementation). Internal benchmarks show that it's slower than generated
> code and the code size reduction is less than we expected. We might enable
> it to replace the reflection-based dynamic parsing code since that's an
> easy win, but more work is required before it can replace generated code.
>

Got it, thanks! For us we are not so i-cache bound so I think we'll ignore
the new feature for now.

-Todd

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to