[jsword-devel] [JIRA] Commented: (JS-134) JDOM Upgrade and Optimisation

DM Smith (JIRA) jira at crosswire.org
Tue Nov 30 07:26:38 MST 2010


    [ http://www.crosswire.org/bugs/browse/JS-134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13585#action_13585 ] 

DM Smith commented on JS-134:
-----------------------------

I've checked it in. Please test. If you like it then mark it as resolved.

> JDOM Upgrade and Optimisation
> -----------------------------
>
>                 Key: JS-134
>                 URL: http://www.crosswire.org/bugs/browse/JS-134
>             Project: JSword
>          Issue Type: Improvement
>          Components: o.c.jsword.book.filter.osis
>         Environment: Android
>            Reporter: Martin Denham
>            Assignee: DM Smith
>            Priority: Minor
>
> Only JDOM version 1.1.1 is compatible with Android so in my copy I upgraded JSword's JDOM 1.0 to 1.1.1 which caused no issues because JDOM is so stable and well tested.
> JDOM 1.1.1 also provides a new SAXBuilder flag for faster parsing (see second paragraph of jdom.org) which I think is SAXBuilder.setFastReconfigure() which has this description:
> "Specifies whether this builder will do fast reconfiguration of the underlying SAX parser when reuseParser is true. This improves performance in cases where SAXBuilders are reused and lots of small documents are frequently parsed. This avoids attempting to set features on the SAX parser each time build() is called which result in SaxNotRecognizedExceptions."
> I added this flag to OSISFilter and OSIS parsing was improved by about 20%.  My tests monitored the time from the first OSISFilter.parse() to the last parse() so it is not a 20% improvement on the whole time it takes to show a chapter.
> Here is And Bible's code from OSISFilter with the one line change:
>     private Element parse(String plain) throws JDOMException, IOException {
>         // create a root element to house our document fragment
>         StringReader in = new StringReader("<div>" + plain + "</div>"); //$NON-NLS-1$ //$NON-NLS-2$
>         InputSource is = new InputSource(in);
>         SAXBuilder builder = new SAXBuilder();
>         //MJD START
>         builder.setFastReconfigure(true);
>         //MJD END
>         Document doc = builder.build(is);
>         Element div = doc.getRootElement();
>         return div;
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://www.crosswire.org/bugs/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jsword-devel mailing list