[jdom-interest] String Interning

Jason Hunter jhunter at collab.net
Wed Aug 8 12:40:59 PDT 2001


Parsers do interning, and Xerces does a faster intern than
String.intern(), so thus far we've let the parsers handle it.  That's
not 100% sufficient tho since a parser is legally free to not intern,
which is why we have this in the TODO.txt:

* Examine if it's worth doing an intern() on element and attribute
names,
  or if it's too much to pay since SAX is likely doing it already
  http://www.megginson.com/SAX/Java/features.html
  Probably turn off SAX interning and do it ourselves?  Note commentary:
 
http://lists.denveronline.net/lists/jdom-interest/2000-October/003289.html
  Regardless, the SAX builder should not assume there's interning!

-jh-

rshumway at orincon.com wrote:
> 
> Perhaps this is a naive question, but I was wondering why none of the
> JDOM classes intern() the Strings they encapsulate.  Seems like it
> might save a lot of storage, especially for those of us who store lots
> of docs in memory concurrently.  I would think it would be trivial to
> implement in the constructors of the various classes.  Since most
> of my docs are read from disk through a parser, I'm not certain how
> I would intern() the Strings myself, without hacking the JDOM source.
> 
> Thanks for you help,
> Ross
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list