I'm working on legacy project that has some beans with up to 300 fields. 
The problem is that serialization of such beans (to byte array for example) 
takes more than 50 microseconds that is too much as I can get no more than 
20000 msg/sec in this case. I've found that writeTo() method is fast 
and it's build() method that takes so long. It copies all 300 fields from 
mutable container (Bean.Builder) to immutable container (Bean). It's very 
useful to have immutable objects but I don't need to. All I need is high 
throughput but protobuf gives me no choice between immutable and mutable 
classes. Also I'm not allowed to refactor the bean as it widely used. For 
example I could diminish the count of fields by introducing nested objects 
- but I'm not allowed as I said. 

But I see Bean.Builder itself has all the data to provide serialization. It 
has all the fields, all the nested builder/objects and the same bitmasks. 
So wonder why not to implement writeTo() methods in Bean.Builder itself? 
That would allow to avoid redundant copy from Builder to Bean.

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to