On 19 tammi, 20:31, Kenton Varda <ken...@google.com> wrote:
> I'm not sure I understand.  I think you are using the word "group" to mean
> something different than what it means in the .proto language.  At least, I
> hope so, because the "group" in the .proto language is deprecated.

Yes, I've got a domain model containing many to one relation between
'Contract' and 'Group'.

These Groups can be called ContractGroups if you will.

> Are you suggesting that the parser should automatically intern every String
> that it parses?  That sounds like it could be expensive for those who don't
> need it.  Maybe you should re-design your data structure so that it doesn't
> end up containing lots of copies of the same strings?

Usually I've got some 20-40 groups, each containing around 200 - 2000
contracts. Since these Groups are just strings (name of ..) I was
thinking that modeling them via intern would be an option.

Would it be possible to have such an option for specific string field,
something like [intern = true]? This would, of course, only help
runtime overhead, and be of no help on-the-wire.

I'm now moving towards having each contract carry an int, specifying
'id' of such ContractGroup.

>
> On Tue, Jan 19, 2010 at 1:23 AM, Kalle Kärkkäinen
> <kalle.karkkai...@me.com>wrote:
>
>
>
> > Hi,
>
> > I'm modeling contracts that need to reside in a group. Groups are
> > strings, basically.
>
> > I've got rather many contracts, and I was thinking if it was possible
> > to have strings interned so they would take less memory. Since this
> > would be a load time change (load string up, intern it, and use what
> > ever that produced) I see little chance of getting it done good with
> > option extensions. (which I think are really just tags??)
>
> > It would be difficult (although not impossible) to model groups as
> > numbered-ids and have different message for them.
>
> > In my domain, I'd be left with the bigger problem of handling
> > uniqueness of the id (name would be superficially easier to guarantee
> > unique).
>
> > What say you? Would interned strings be reasonable java enhancement?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To post to this group, send email to proto...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.c 
> > om>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/protobuf?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@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