Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] profiler

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Wolfgang Hoschek <whoschek AT lbl.gov>, xom-interest <xom-interest AT lists.ibiblio.org>
  • Cc:
  • Subject: Re: [XOM-interest] profiler
  • Date: Wed, 24 Nov 2004 06:40:26 -0500

Wolfgang Hoschek wrote:


Any good ideas should be welcome. If one can figure out how to effectively bound the cache and maintain high hit ratio it would be interesting.

A synchronized HashSet would let us have O(1) insertion and lookup, but I'm not sure what the constant time performance would be like.

Bounding the set is tricky. We could just pick some number like 1024 for the set's upper bound, and clear it every time that value is reached. Or maybe allow it to be set by a system property, or some such.

The real question is whether the constant time retrieval from the set would be larger than just checking the names manually. Namespace URLs are expensive to check because:

1. They're quite long
2. The algorithm for checking them is quite involved, and creates lots of temporary strings.

Element names, in practice, are much shorter than namespace URIs and the algorithm for checking them is much simpler, and does not create any temporary objects. It just blasts through the string checking each character against a lookup table.

My gut feeling is that a cache would not be faster here, but I could be wrong about that.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page