Re: [protobuf] How realistic are benchmarks such as NorthWind ?

2010-05-14 Thread Kevin Apte
Marc: Thanks for your input. I think your comment helps me clarify my query: Most applications or services that are "producers" will generate data with N fields in it. Consumers may be interested in only m fields- m could be 5 and N could be 20. For example: An address book service will generate

Re: [protobuf] Re: Can I add a new item into an existing list of enumerations safely?

2010-05-14 Thread Jason Hsueh
Oh, the other thing about extensions: it may result in smaller message sizes. For each optional message (command) you add, you're adding a pointer to the message. In-memory size is O(number of fields defined) whereas with extensions it's O(number of fields set). There's some overhead to using exten

Re: [protobuf] Re: Can I add a new item into an existing list of enumerations safely?

2010-05-14 Thread Jason Hsueh
It doesn't matter that much. I only set UNKNOWN = 2 on the assumption that pop and push were already assigned and you needed to preserve wire compatibility. If I were starting from scratch I would probably define UNKNOWN as the first value and set it to 0. Making it the first value defined makes it

[protobuf] Re: Can I add a new item into an existing list of enumerations safely?

2010-05-14 Thread john mani
Thanks. To make this generic and allow for multiple commands to be added in future, would a good strategy be to define: enum Type { POP = 0, PUSH = 1, UNKNOWN = 100 }, and later add TOP, TAIL, etc. etc. as items after PUSH (meaning with values 2, 3 ... ). So, later we have: enum Type { POP = 0

Re: [protobuf] How to get rid of metadata only extensions dependencies

2010-05-14 Thread Jason Hsueh
No, there isn't any way to remove the dependency. The compiler doesn't try to detect why you defined an import. On Fri, May 14, 2010 at 2:38 PM, Igor Gatis wrote: > So, let's say I'm developing a plugin which, say, add or removes builder > pattern to java generator (this is actually a real use c

Re: [protobuf] Can I add a new item into an existing list of enumerations safely?

2010-05-14 Thread Jason Hsueh
Clients with the old binary will not be able to read messages containing the new enum value. This would get treated as an unknown field, meaning that the type field would not be sent in an older client. Since your field is also required, it would fail to parse. So, with this example, you would need

[protobuf] Can I add a new item into an existing list of enumerations safely?

2010-05-14 Thread john mani
Hi This is my first attempt at defining a command pattern : message Command { required Type type = 1; optional Value value = 2; optional Push push = 3; optional Pop pop = 4; } enum Type { POP = 0, PUSH = 1 } I deploy code using this file. Later, I want to add a new command, but

[protobuf] Re: Detect type of message

2010-05-14 Thread john mani
I believe that's the way to do it. I think you can also use the extends, but looks like other language ports (like the C port) do not all support the extend mechanism. ( yet). -john On May 14, 12:45 pm, Vince wrote: > Hi, > > If I want to serialize many message in the same pipe, > do I need one

[protobuf] How to get rid of metadata only extensions dependencies

2010-05-14 Thread Igor Gatis
So, let's say I'm developing a plugin which, say, add or removes builder pattern to java generator (this is actually a real use case). So I created a .proto file with my plugin metadata info: MyPluginMetadata.proto: import "google/protobuf/descriptor.proto" extend google.protobuf.MessageOptions

Re: [protobuf] Nested messages accessor methods

2010-05-14 Thread Jason Hsueh
Yes, you can. What is your target language? The accessor names are generated differently - in C++ you would get lower-cased names. Have you looked at the generated header? You may also want to see http://code.google.com/apis/protocolbuffers/docs/style.html On Fri, May 14, 2010 at 1:29 AM, Jacques

Re: [protobuf] Detect type of message

2010-05-14 Thread Jason Hsueh
Check out the docs: http://code.google.com/apis/protocolbuffers/docs/techniques.html#union On Fri, May 14, 2010 at 12:45 PM, Vince wrote: > Hi, > > If I want to serialize many message in the same pipe, > do I need one "master" message that includes all the others in > optional > and have a kind

[protobuf] Detect type of message

2010-05-14 Thread Vince
Hi, If I want to serialize many message in the same pipe, do I need one "master" message that includes all the others in optional and have a kind of messageType field in it to know which kind a message is inside? Like this, message A1 {...} message A2 {...} message master { enum type {...} req

Re: [protobuf] How realistic are benchmarks such as NorthWind ?

2010-05-14 Thread Marc Gravell
Firstly, I must note that those benchmarks are specific to protobuf-net (a specific implementation), not "protocol buffers" (which covers a range of implementations). Re "is it not more realistic"; well, that depends entirely on what your use-case *is*. It /sounds/ like you are really talking abou

[protobuf] How realistic are benchmarks such as NorthWind ?

2010-05-14 Thread Kevin Apte- SOA and Cloud Computing Architect
I saw that ProtoBuf has been benchmarked using the Northwind data set- a data set of size 130K, with 3000 objects including orders and order line items. This is an excellent review: http://code.google.com/p/protobuf-net/wiki/Performance Is it not more realistic, to have a benchmark with a m

[protobuf] Nested messages accessor methods

2010-05-14 Thread Jacques
Hi, Given the .proto file as below: message NestedObject { required string field = 1; } message OuterObject { required NestedObject nestedObject = 1; } Question: Can one define the nested object within the OuterObject as required? If you can use required, what will the getters/set