You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Luis Bernardo (JIRA)" <ji...@apache.org> on 2013/11/24 12:42:35 UTC

[jira] [Resolved] (FOP-2314) Caching xmlParserClassName in org.apache.fop.svg.SimpleSVGUserAgent

     [ https://issues.apache.org/jira/browse/FOP-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luis Bernardo resolved FOP-2314.
--------------------------------

       Resolution: Implemented
    Fix Version/s: trunk

the "tiger" example (example/fo/svg/embedding.fo) runs 10% faster with this change.

patch applied: http://svn.apache.org/viewvc?view=revision&revision=1544897

> 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
>             Fix For: trunk
>
>         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)

Re: [jira] [Resolved] (FOP-2314) Caching xmlParserClassName in org.apache.fop.svg.SimpleSVGUserAgent

Posted by Gonzalo Vasquez <gv...@altiuz.cl>.
Great, thanks for considering it!

Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (R&D)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasquez@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 24-11-2013, a las 8:42, Luis Bernardo (JIRA) <ji...@apache.org> escribió:

> 
>     [ https://issues.apache.org/jira/browse/FOP-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> 
> Luis Bernardo resolved FOP-2314.
> --------------------------------
> 
>       Resolution: Implemented
>    Fix Version/s: trunk
> 
> the "tiger" example (example/fo/svg/embedding.fo) runs 10% faster with this change.
> 
> patch applied: http://svn.apache.org/viewvc?view=revision&revision=1544897
> 
>> 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
>>            Fix For: trunk
>> 
>>        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)