[jboss-dev-forums] [Design of JBossCache] - Re: Common marshalling infrastructure

galder.zamarreno@jboss.com do-not-reply at jboss.com
Wed Mar 25 16:51:50 EDT 2009


"david.lloyd at jboss.com" wrote : "galder.zamarreno at jboss.com" wrote : 2.- Looking at JBoss Marshalling, I saw that you're considering primitive arrays as known classes but primitive object arrays are not. Is this an oversight or on purpose? i.e.
  |   | 
  |   | map.put(Byte[].class, Protocol.ID_BYTE_ARRAY_CLASS);
  |   |   | map.put(Boolean[].class, Protocol.ID_BOOLEAN_ARRAY_CLASS);
  |   |   | map.put(Character[].class, Protocol.ID_CHAR_ARRAY_CLASS); 
  |   |   | ...
  |   | 
  | 
  | The reason for this is that primitive array classes do not extend the object array class.  Since all object arrays are represented by a single byte plus the component type information, there should be one byte to signify the array plus one byte for the primitive wrapper, which is two bytes (not too bad).  Likewise, e.g. Byte[][].class would be three bytes, etc.  If the length is still unacceptably long, a ClassTable can be used to reduce it down to a single byte.
  | 
  | 

Yeah, but the problem here is that aftewards, you're treating Primitive Object arrays as serializable and you're not taken advantage of the same performance gains that you applied to primitive arrays. 

IOW, in RiverMarshaller.doWriteObject, primitive arrays are treated specially and this is done based on class id coming BASIC_CLASSES. Now, if you don't give the same class IDs or paralell ones to primitive object arrays (Byte[], Integer[]...etc), you're missing out on a performance improvement gain.

Currently, looks to me primitive object arrays would be treated as Serializable.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221109#4221109

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221109



More information about the jboss-dev-forums mailing list