David M. Lloyd wrote:
Yes, Galder has such a test. :-) And yes, JBoss Marshalling writes
booleans as a single byte
Do you encode the value and type into the single byte ? Assuming you
need 1 bit for the value, you have 7 bits left for the type, which
leaves you with ~ 128 types. Is this assumption correct ?
(or, in the case of boolean[], a single bit).
How ?
The test won't likely pass fully until Galder reimplements the
custom
marshalling parts as ObjectTable instead of Externalizers. With the
current Externalizer-based design, it might write:
- This is an externalized object = 1 byte
- The class of the externalized object is in the class table = 1 byte
- The class table entry for the externalized class = 1 byte
- The externalizer object is predefined = 1 byte
- This is the custom ID of the externalizer object = 1 byte
- Begin custom object data = 1 byte
- Custom object data length = 1-4 bytes depending on N
- This is the custom object data = N bytes
- End custom data = 1 byte
Giving 8+N to 11+N bytes or more, depending on the mix of objects and
primitive data in the custom data block, due to the security features
in Externalizers which are not needed in ISPN. With an object table
it would write:
- This object is predefined = 1 byte
- This is the custom ID of the predefined object = 1 byte
- This is the custom object data = N bytes
This is 3 bytes compared to the 2 currently used, and - as you said
above - I think we can even get down to only 1 byte for a boolean (or
Boolean). I don't want to nitpick, but can't we get JBMAR to marshall a
boolean into 1 byte ? If we send 10 million messages with a boolean,
then the overhead gets quite large !
--
Bela Ban
Lead JGroups / Clustering Team
JBoss - a division of Red Hat