Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] More Serializer performance patches

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: Wolfgang Hoschek <whoschek AT lbl.gov>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] More Serializer performance patches
  • Date: Thu, 21 Jul 2005 13:05:58 -0700

3. revert Serializer.writeNamespaceDeclarations to previous impl (the
recently changed CVS impl shows a 25% degradation)

You could use an entrySet rather than a keySet to avoid get(prefix) lookups.

Iterator iterator = prefixes.keySet().iterator(); // WH should use entrySet()
...
Map.Entry entry = (Map.Entry) iter.next()
prefix = entry.getKey();
uri = entry.getValue();

It might help a bit but I haven't tried it.

Apart from this specific issue, in general, my impression is that this and many more namespace related issues might better be eliminated by solving the root problem: have a data structure and related methods in class Namespaces that are both more time efficient and *much* more space efficient. The current data structure is just a horrible mismatch for access patterns related to iterating over namespaces and namespaces-in-scope, in particular since Element.getPrefixesInScope() is not public. I realize it's not that straighforward to do it without breaking correct semantics, but it should nonetheless be doable.

[For example, it turns out I need Element.getPrefixesInScope() for some special cases arising in the XQuery Serializer. Now I can choose between three options, all of which unsatifactory: a) copy&paste it (licence problem), b) make the method public (incompatible), c) write my own impl. (horribly inefficient since it has no access to package protected methods).

Wolfgang.




Archive powered by MHonArc 2.6.24.

Top of Page