[jdom-interest] Getting rid of text caching

Louis Tribble ltribble at pacbell.net
Fri Aug 25 09:47:51 PDT 2000


on 8/17/00 9:19 PM, Jason Hunter at jhunter at collab.net 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.

I've been on vacation, but I didn't see any comments. My first reaction
when I saw the caching in the code was that it was an optimization that
benefits some usage patterns but not others. In my case, getText would be
called only once on most of the elements anyways. And I'm not keeping the
text around as text in most cases, so the caching would be more like a
memory leak (albeit a bounded one)...

Louis




More information about the jdom-interest mailing list