[jdom-interest] Optimizing attribute lists size in built documents
Laurent Bihanic
laurent.bihanic at atosorigin.com
Fri Jun 27 06:57:21 PDT 2003
Hi,
The attached patch is a proposal to change the way SAXHandler adds attributes
to elements. Instead of adding each attribute at the time, this patch uses a
reusable ArrayList to collect all attributes and add them to the element using
setAttributes.
Combined with the AttributeList patch I send yesterday, it avoids resizings of
Element.attributes that occurs when using Element.setAttribute().
Laurent
--
wWw
(o o)
-------------ooO-(_)-Ooo-----------------------------------------------
Laurent Bihanic | Tel: +33 (0)1 55.91.21.93 (direct)
AtosOrigin Systems Integration | +33 (0)1 55.91.20.00
e-Business / SC | Fax: +33 (0)1 55.91.22.31
Les Miroirs - Bat. C |
18, avenue d'Alsace |
F-92926 La Defense Cedex | E-mail: laurent.bihanic at atosorigin.com
-----------------------------------------------------------------------
"Microsoft isn't the answer. Microsoft is the question and the answer
is no."
DISCLAIMER:
The opinions expressed are entirely my own and may not necessarily be
those of my employer. Also, I am not now nor have I ever been a
lawyer. My opinions are provided as-is with absolutely no warrantee of
merchantability or fitness for any particular use. Besides, you can't
prove I typed this. No body saw me type this. Who says I typed this?
-------------- next part --------------
Index: SAXHandler.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/input/SAXHandler.java,v
retrieving revision 1.59
diff -r1.59 SAXHandler.java
91a92,94
> /** Temporary <code>List</code> object to store element contents. */
> private List attributeList;
>
204a208
> attributeList = new ArrayList();
544c548
< element.setAttribute(attribute);
---
> attributeList.add(attribute);
545a550,551
> element.setAttributes(attributeList);
> attributeList.clear();
More information about the jdom-interest
mailing list