<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Tahoma">Sounds reasonable to me. <br>
I've always been aware that at a certain document size, I had to
switch from using JDOM to parsing things at the SAX layer.<br>
This means I can delay some of decisions a little longer :-)<br>
</font><br>
Rolf wrote:
<blockquote cite="mid:4F02133C.5010704@tuis.net" type="cite">Hi all.
<br>
<br>
Memory optimization has never been a top priority for JDOM. At the
same time, for what it does, JDOM is not a 'terrible' memory user.
Still, I have done some analysis, and, I believe I can trim about
a quarter to a half of 'JDOM Overhead' memory usage by making two
'simple' changes....
<br>
<br>
The first is to merge the ContentList class in to the Element
class (and also in to Document). This will reduce the number of
Java objects by about half, and that will save about 32 bytes per
Element at a minimum in a 64-bit JRE. Additionally, by
lazy-initialization of the Content array, we can save memory on
otherwise 'empty' Elements.
<br>
<br>
This can be done by extending the Element (and perhaps Document)
class to extend 'List'. It can all be done in a 'backward
compatible' way, but also leads to some interesting possibilities,
like:
<br>
<br>
for (Content c : element) {
<br>
... do something
<br>
}
<br>
<br>
(for backward compatibility, Element.getContent() will return
'this').
<br>
<br>
<br>
The second change is to make the AttributeList instance in Element
a lazy-initialization. This would save memory on all Elements that
have no attributes, but would have an impact for people who
sub-class the Element class and may expect the attributes field to
be non-null.
<br>
<br>
<br>
I am trying to get a feel for how important this sort of
optimization may be. If there is interest then I will make some
changes, and test the impact. I may make a separate branch in
github to test it out....
<br>
<br>
If the above changes are unrealistic then I don't think it makes
sense to even try....
<br>
<br>
Rolf
<br>
_______________________________________________
<br>
To control your jdom-interest membership:
<br>
<a class="moz-txt-link-freetext" href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a>
<br>
<br>
</blockquote>
<br><br><br><hr><font size="-2" color=808080>Disclaimer: <a href="http://www.peralex.com/disclaimer.html">http://www.peralex.com/disclaimer.html</a><br><br>
</body>
</html>