[ 
https://issues.apache.org/jira/browse/FOP-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13824992#comment-13824992
 ] 

Luis Bernardo commented on FOP-2314:
------------------------------------

initial measurements with the sample provided do seem to indicate a performance 
improvement around 15%. I will perform some further tests but this seems to be 
a good suggestion.

as a side note, if all you want is rectangles (borders) you don't need to use 
SVG. you can achieve the same just with FO and it would be faster.

> Caching xmlParserClassName in org.apache.fop.svg.SimpleSVGUserAgent
> -------------------------------------------------------------------
>
>                 Key: FOP-2314
>                 URL: https://issues.apache.org/jira/browse/FOP-2314
>             Project: Fop
>          Issue Type: Improvement
>          Components: svg
>    Affects Versions: trunk
>         Environment: Tested on Mac OSX 10.9, Java SE 7 (1.7.0_04)
>            Reporter: Gonzalo Vasquez
>            Priority: Minor
>              Labels: performance
>         Attachments: SimpleSVGUserAgent.java.patch, sample.fo
>
>
> After having profiled an application I'm coding, and having detected hotspot 
> methods, I've come across with a few suggestions por performance improvement 
> which actually have worked in my environment.
> Changing the referenced method to the following code makes the small trick:
> From:
>     public String getXMLParserClassName() {
>         try {
>             SAXParserFactory factory = SAXParserFactory.newInstance();
>             return factory.newSAXParser().getXMLReader().getClass().getName();
>         } catch (Exception e) {
>             return null;
>         }
>     }
> To:
>     private static final String xmlParserClassName;
>     static {
>         String result;
>         try {
>             SAXParserFactory factory = SAXParserFactory.newInstance();
>             result = 
> factory.newSAXParser().getXMLReader().getClass().getName();
>         } catch (Exception e) {
>             result = null;
>         }
>         xmlParserClassName = result;
>     }
>     public String getXMLParserClassName() {
>         return xmlParserClassName;
>     }
> Could this be added as a patch to the trunk please?



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to