Re: Numerical Formats

2009-02-23 Thread Tim

Hi Kenton. I was wondering if you had any update on implementing
packed repeated fields using wire format 2. I'm evaluating GPB for use
in an embedded device, and love it for its ability to generalize data
storage/serialization/introspection. But having a tag for each
repeated element is kind of a deal-breaker for us due to space
requirements. Especially since we're planning to use 4 byte tags
across the board in our system so that there's enough space for a
unique tag for each attribute in our system.
Curious, and Thanks,
Tim

On Jul 8 2008, 10:13 am, Kenton Varda ken...@google.com wrote:
 2008/7/8 hepaminondas hepaminon...@gmail.com:



  Hi,
  Pretty cool stuff!
  Could be really useful for data flow in scientific applications.
  Just wondering how I'd write a proto which would allow the encoding
  of, for example, a Numpy array?

 What's a Numpy array, exactly?  Google search suggests it's a
 multi-dimensional array?

 Unfortunately this would have to be pretty ad-hoc at the moment.  You do
 something like:

 message Row { repeated int32 element = 1; }
 message Matrix { repeated Row row = 1; }

 Ugly, I know.  Another problem with this is that a 1-byte tag will be
 emitted for every element, meaning it's somewhat inefficient.

 Another option is to just pack all the data arbitrarily and store them in a
 bytes field, but that sort of defeats the purpose of protocol buffers.

 I have plans to add a new packed encoding for repeated fields, which would
 allow there to be a single tag for an entire repeated field, but it's not
 there yet, and it still doesn't provide good multi-dimensional support.

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



Re: Numerical Formats

2009-02-23 Thread Kenton Varda
On Mon, Feb 23, 2009 at 7:26 PM, Tim timbla...@gmail.com wrote:

 Hi Kenton. I was wondering if you had any update on implementing
 packed repeated fields using wire format 2. I'm evaluating GPB for use
 in an embedded device, and love it for its ability to generalize data
 storage/serialization/introspection. But having a tag for each
 repeated element is kind of a deal-breaker for us due to space
 requirements. Especially since we're planning to use 4 byte tags
 across the board in our system so that there's enough space for a
 unique tag for each attribute in our system.
 Curious, and Thanks,
 Tim


It's implemented in SVN, and will be in the next release (2.0.4), whenever
that may be.  Just stick [packed=true] on to any repeated scalar field:
  repeated int32 foo = 1 [packed=true];




 On Jul 8 2008, 10:13 am, Kenton Varda ken...@google.com wrote:
  2008/7/8 hepaminondas hepaminon...@gmail.com:
 
 
 
   Hi,
   Pretty cool stuff!
   Could be really useful for data flow in scientific applications.
   Just wondering how I'd write a proto which would allow the encoding
   of, for example, a Numpy array?
 
  What's a Numpy array, exactly?  Google search suggests it's a
  multi-dimensional array?
 
  Unfortunately this would have to be pretty ad-hoc at the moment.  You do
  something like:
 
  message Row { repeated int32 element = 1; }
  message Matrix { repeated Row row = 1; }
 
  Ugly, I know.  Another problem with this is that a 1-byte tag will be
  emitted for every element, meaning it's somewhat inefficient.
 
  Another option is to just pack all the data arbitrarily and store them in
 a
  bytes field, but that sort of defeats the purpose of protocol buffers.
 
  I have plans to add a new packed encoding for repeated fields, which
 would
  allow there to be a single tag for an entire repeated field, but it's not
  there yet, and it still doesn't provide good multi-dimensional support.


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