[jdom-interest] Getting rid of text caching

Jason Hunter jhunter at collab.net
Thu Aug 17 21:19:29 PDT 2000

Jason Hunter wrote:
> I've been thinking this afternoon about the text caching we do for
> getText() and getTextTrim().  I'm wondering if it gives us enough bang
> for our buck.  The advantage is speeding up accesses to the text data
> after the first request; the cost is increased memory consumption (all
> text content duplicated 2 or 3 times in memory!) and more complicated
> code -- and perhaps a synchronization call.

To be 100% factual, if we were smart in our getText() method and didn't
use a StringBuffer for the common places where there's only one String,
we could save some memory.  In fact, that's probably a good optimization
with or without caching.  That just reduces the bloat though, issue's
still there.


More information about the jdom-interest mailing list