[jdom-interest] Reusing parsers
Elliotte Rusty Harold
elharo at metalab.unc.edu
Sun Apr 6 09:05:15 PDT 2003
At 5:00 PM -0700 2/26/03, nobody wrote:
>While doing some profiling of one of our application, it appeared that the
>allocation of Xerces 2.2.1 instances by SAXBuilder can be quite time consuming
>due to the large number of objects Xerces creates. I made a patch to
>SAXBuilder to support reusing parser instance.
>The results: Our application went from 200 req/s to 330 thanks to
>this patch only.
>
>New method: SAXBuilder.setReuseParser(boolean)
>
>Default value is currently false, for safety.
This is unnecessary configuration. Too many options make an API hard
to understand. This is yet another method for clients to worry about.
SAXBuilder should either reuse parsers or not (probably it should
reuse them) but there's no reason to make this a configurable option.
The JavaDocs suggest this is for thread-safety, but I doubt
SAXBuilder is thread-safe whether we reuse parsers or not. I suggest
deleting this method.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list