Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] QName flyweights

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: norwoods <norwoods AT gbronline.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] QName flyweights
  • Date: Thu, 09 Jun 2005 11:34:28 -0700

Wolfgang Hoschek wrote:

The current xom-1.1 CVS code is generally rather inefficient due to heavy usage of String.intern() in Element and Attribute and has less than optimal memory footprint. So, I'd like to float some ideas centered around more efficient handling of (prefix, localName, URI) tuples, both in space and time.

What could be done to reduce memory footprint and simultaneously improve performance, both when assembling a document in memory and when building it via Builder? Below is a commented prototype idea in this directionl, based on the "flyweight" pattern.

Comments, other ideas, anyone?

Wolfgang.


hashcodes do not map 1 to 1 to objects; more than one object may have any given hashcode. you need a strategy to deal with the possible conflict. this could violate the first xom Design Goal, Absolutely correct.

one could also have flyweight namespaces, uri and prefix; and flyweight qnames, flyweight namespace and local name.

setPrefix, setURI, setName, setLocalName are all complicated by flyweight qnames.

what is the garbage collection strategy? the qnames will remain in the hashmap even after all other references have disappeared.

norwood sisson





Archive powered by MHonArc 2.6.24.

Top of Page