[jdom-interest] Reference comparisons in SAXHandler.startElement

Jason Hunter jhunter at collab.net
Tue Mar 13 15:56:36 PST 2001

> I remember some time in the late JDK 1.1 or early JDK 1.2 timeframe, Sun
> engineers were basically saying that intern() wasn't worthwhile - it often
> slowed things down more than it sped things up. I don't know about memory
> usage, though. Do we think that it's currently useful? 

In XML there's a small set of element names that are used over and
over.  Interning thus will save quite a lot of memory, and that's why
all common parsers use interning.  (Note JDOM's been around for 11
months before someone found a parser that didn't by default intern.)  I
think the memory saving benefits of intern are likely to be significant,
so barring evidence to the contrary I'd like to continue to take
advantage of interning, either by telling the parser to intern or
interning ourselves.  Only thing holding up action is the need to run
perf tests to validate my assumptions.  I'm curious especially how much
faster Xerces' custom interning is than traditional intern()ing.  It
must be a lot, because of the significant sacrifice in code readability
they made to implement their custom scheme.


More information about the jdom-interest mailing list