[XOM-interest] Unicode forms for internal storage&In-Reply-To=20030420212424.77D5824AEB6 at mail.ibiblio.org

DHollenbeck dick at softplc.com
Wed Jan 21 13:58:44 EST 2004


I have written a JVM myself.  From that experience I found that the 
memory overhead of any Java Object, as it exists in the implementing 
C/C++ code, is a significant factor of the total memory a Java program 
will use.

This is especially true when you have lots of small Java Objects.  In 
XML, often we are dealing with strings less than about 20 characters.   
Therefore, anything that can be done to reduce Java Object count is good.

On this basis, I would think that an object of this type is optimal 
speed/size tradeoff:

char[]

Yes, just a char[] array.  One that can be passed to the String() 
constructor.

Also, at some point I would have incorporated the embedded ArrayList 
object's functionality that you have in your Node hierarchy into the 
parent Node class itself.  You'll get both speed and memory pickup doing 
this.
i.e. make your Node (or whatever the parent class is) incorporate the 
[customized] functionality of ArrayList into its methods such that you 
no longer need to include ArrayList as a member.  You will reduce the 
Java Object count by the number of Nodes in the XML document, this means 
less memory, faster instantiation time, etc.


Dick Hollenbeck





More information about the XOM-interest mailing list