[jdom-commits] CVS update: jdom/src/java/org/jdom
jhunter at cvs.jdom.org
jhunter at cvs.jdom.org
Thu May 24 01:57:17 PDT 2001
Date: Thursday May 24, 2001 @ 9:57
Author: jhunter
Update of /home/cvspublic/jdom/src/java/org/jdom
In directory www.nmemonix.com:/tmp/cvs-serv878
Modified Files:
Document.java Element.java
Log Message:
Changed Document and Element internal LinkedList implementation to
ArrayList. PartialList comes later. No changes to the public API.
This change of list gives us a remarkable reduction in memory sizes for
all large documents tested. Small documents remain unchanged. It appears
an initial array size of "5" is the sweet spot.
Here are some numbers. Each quantity is the amount of extra memory
consumed by building a Document instance of the particular XML file.
Note this is not necessarily the same as the amount of memory consumed
by the Document instance (since you can't force a full GC to know what
could be collected and what must be retained).
The first column is with LinkedList. The second column is with standard
ArrayList (initial size of 10). The third column is with an initial
size of 5 (what I'm checking in).
xlink.xml: 14.4M, 13.1M, 10.3M (28% reduction)
med.xml: 4.9M, 4.1M, 4.0M (18% reduction)
nsP0.xml: 1.39M, 1.45M, 1.26M (9% reduction)
web.xml: 525K, 525K, 525K (no change)
The web.xml file is trivially small. The 525K bytes appears to be a
fixed overhead memory consumption incurred during a build process.
Nearly all of it would be elegible for GC I suppose. Considering there
are objects from the build included as fixed costs in the calculations
above, it makes the percentage reduction in actual usage even more
impressive than shown here.
Thanks to the many folks on jdom-interest for helping encourage this
change, especially phil at triloggroup.com.
-jh-
P.S. Note that iterator access is still the best choice, because of the
nature of having a view list around a live list. For example, with a
FilterList if you have a list of children and ask for child element #5
that doesn't directly map to an indexed location in the actual content
list.
===================================================================
File: no file Document.java Status: Needs Checkout
Working revision: 1.41 Thu May 24 08:57:17 2001
Repository revision: 1.41 /home/cvspublic/jdom/src/java/org/jdom/Document.java,v
Existing Tags:
start (revision: 1.1.1.1)
jdom (branch: 1.1.1)
===================================================================
File: no file Element.java Status: Needs Checkout
Working revision: 1.79 Thu May 24 08:57:17 2001
Repository revision: 1.79 /home/cvspublic/jdom/src/java/org/jdom/Element.java,v
Existing Tags:
start (revision: 1.1.1.1)
jdom (branch: 1.1.1)
More information about the jdom-commits
mailing list