xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Possible ArrayList optimization
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: "Bradley S. Huffman" <hip AT a.cs.okstate.edu>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Possible ArrayList optimization
- Date: Sun, 11 May 2003 10:22:59 -0400
At 8:10 PM -0500 5/9/03, Bradley S. Huffman wrote:
I'm assuming you mean spped when building from a SAX source. First in XOM,
get rid of the parent stack, it's not needed, you can call getParent() in
endElement(...).
I don't see how that would work. getParent() returns null before I've added it to the parent. That's why I need the parent stack. I could move more work into endElement() but I'm not sure how that would help.
Also I think you can add attributes and namespace
declarations in one loop instead of two.
Good idea. Probably a small improvement, but couldn't hurt.
Now obviously, what would be ideal is to know the number of children at
element creation, but that's not going to happen with SAX. So here's a
wild idea, have a large buffer to hold newly created nodes. In all node
creation methods (startElement, comment, flush*(), etc.) buffer the newly
created node but **don't** add it to the current parent (as JDOM and XOM
currently do), instead just increment the child count of the current parent
(either find some way to use the parent to hold this info, or stack it).
Finally in endElement(...) create the children list in the current
parent according to the current child count and move nodes from the buffer
to the parent. This should eliminate most unnecessary reallocation and
copying of nodes. Hmmm, guess it would also eliminate the wasted overhead :)
Sounds pretty complex. Right now my tests are showing this is not where my hot spots are during building. Verification and parsing overhead just swamp this. More on that shortly.
--
Elliotte Rusty Harold
elharo AT metalab.unc.edu
Processing XML with Java (Addison-Wesley, 2002)
http://www.cafeconleche.org/books/xmljava
http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA
-
[XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/09/2003
- Re: [XOM-interest] Possible ArrayList optimization, John Cowan, 05/09/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
dirk bergstrom, 05/09/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/09/2003
- Re: [XOM-interest] Possible ArrayList optimization, Elliotte Rusty Harold, 05/11/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/09/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Bradley S. Huffman, 05/09/2003
- Re: [XOM-interest] Possible ArrayList optimization, Elliotte Rusty Harold, 05/10/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/11/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Bradley S. Huffman, 05/12/2003
- Re: [XOM-interest] Possible ArrayList optimization, Elliotte Rusty Harold, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Bradley S. Huffman, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Janek Bogucki, 05/11/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
dirk bergstrom, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/13/2003
- Re: [XOM-interest] Possible ArrayList optimization, Karl Waclawek, 05/13/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/13/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
dirk bergstrom, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/12/2003
- <Possible follow-up(s)>
- RE: [XOM-interest] Possible ArrayList optimization, New, Cecil (GEAE), 05/13/2003
Archive powered by MHonArc 2.6.24.