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

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Jan 22 10:04:14 EST 2004


At 12:58 PM -0600 1/21/04, DHollenbeck wrote:

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

Currently I'm using a byte[] array in Text. Most of the strings in 
other classes (e.g. element names, namespace prefixes, etc.) are 
interned which helps a lot.

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

I might try this post 1.0. It should be doable completely in the 
private parts. It would need profiling to prove that it really works. 
A couple of other benfits I see to this approach:

1. It would make it easier to back port to 1.1 if I don't depend on 
the Collections API.
2. Debugging would be easier because variable inspection would have 
one less level of indirection.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the XOM-interest mailing list