Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Opitmizations: top-down vs. bottom up

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: whoschek AT lbl.gov
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] Opitmizations: top-down vs. bottom up
  • Date: Sat, 27 Nov 2004 06:59:01 -0500

Wolfgang,

Looking at your recent profiles, one thing that struck me was the amount of time being spent in insertionAllowed. Looking at that method I don't see any obvious ways to optimize but I did notice that one might get some improvement based on order of insertion. In particular, it looks to me like it may be significantly faster to construct documents from the top down than the bottom up. That is, one should add an element to its parent before adding any children to the element. This short-circuits some possibly expensive checks.

Your code may already be operating like this, but if it's not I'd be very curious to switch this around and see what happens. Similarly, if anyone else has any measurements on code that builds documents in memory, I'd like to find out the difference between root-down and child up constructions. Thanks.

I don't think this will have any affect on XOM's code base, unless someone sees an optimization for insertionAllowed I don't see (entirely possible: it's 7:00 A.M. and I haven't had my coffee yet) but if it does prove to be significant I'll at least put a note in the JavaDoc or the FAQ or both about this.

--
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




  • [XOM-interest] Opitmizations: top-down vs. bottom up, Elliotte Harold, 11/27/2004

Archive powered by MHonArc 2.6.24.

Top of Page