Re: Byte and char types

From: Scott Ferguson <ferg@xxx.com>
Date: Fri Jun 16 2006 - 14:21:49 PDT

On Fri, 2006-06-16 at 15:07 -0400, Paul W. Cowan wrote:
> We're evaluating Hessian for use on embedded devices that connect over
> wireless modems. Each message we pass contains multiple elements
> who's value is a single character or number less than 255. We're
> curious as to why there is no byte or char or short primitive types,
> when the idea is to be a compact binary protocol. It may seem
> insignificant, but the extra overhead of 3 or 4 bytes for each int or
> binary format value becomes significant in volume.

That's something we've been thinking about for a possible Hessian 1.1.

The initial plan for Hessian was to make is as simple as possible. So
Hessian 1.0 has a very few number of data types.

We wouldn't add any data types, but we might could add extra compact
encodings like the following:

  0x80 - 0xbf = an integer in the range -32 to 31
  0xc0 - 0xcf = 'S' 0x00 0x00 to 'S' 0x00 0x0f
  0xd0 - 0xdf = 'B' 0x00 0x00 to 'B' 0x00 0x0f
  0xe0 - 0xef = 'X' 0x00 0x00 to 'X' 0x00 0x0f
  0xf0 = followed by 8-bit byte
  0xf1 = followed by 16-bit short
  0xf2 = 'S' with 8-bit length
  0xf3 = 'B' with 8-bit length
  0xf4 = 'X' with 8-bit length
  0xf8 = 0.0
  0xf9 = 1.0

And also add an 'O' for Object definition and 'o' for object instance.
The object definition might look like:

O t 0x00 0x07 qa.Test
  S 0x00 0x03 foo
  S 0x00 0x03 bar
  z

o I 0x00 0x00 0x00 0x00 (matches O's order)
  I 0x00 0x00 0x00 0x17 (value for foo)
  I 0x00 0x00 0x00 0x33 (value for bar)

Compressed, that might look like

o 0xc0
  0xd7
  0xf0 0x33

Those wouldn't add any datatypes, just some compression of common
values.

Any comments?

-- Scott
   
>
> Thanks
>
Received on Fri 16 Jun 2006 14:21:49 -0700

This archive was generated by hypermail 2.1.8 : Thu Sep 28 2006 - 20:16:41 PDT