You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tiles.apache.org by "Gagan Arora (JIRA)" <ji...@apache.org> on 2015/07/18 06:42:04 UTC

[jira] [Updated] (AUTOTAG-21) AbstractModelBody.evaluateAsString uses regular expression to replace the contents of the string. It should be able to use a pre compiled Pattern instead for performance reason

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

Gagan Arora updated AUTOTAG-21:
-------------------------------
    Attachment: AbstractModelBody.patch

patch attached

> AbstractModelBody.evaluateAsString uses regular expression to replace the contents  of the string. It should be able to use a pre compiled Pattern instead for performance reason
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AUTOTAG-21
>                 URL: https://issues.apache.org/jira/browse/AUTOTAG-21
>             Project: Tiles Autotag
>          Issue Type: Improvement
>    Affects Versions: 1.1.0
>            Reporter: Gagan Arora
>         Attachments: AbstractModelBody.patch
>
>
> I am seeing high CPU utilization on AbstractModelBody.evaluateAsString method in my thread dumps. 
>  java.lang.Thread.State: RUNNABLE
>         at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
>         at java.util.regex.Pattern$Curly.match0(Pattern.java:4158)
>         at java.util.regex.Pattern$Curly.match(Pattern.java:4132)
>         at java.util.regex.Pattern$Branch.match(Pattern.java:4502)
>         at java.util.regex.Pattern$Start.match(Pattern.java:3408)
>         at java.util.regex.Matcher.search(Matcher.java:1199)
>         at java.util.regex.Matcher.find(Matcher.java:592)
>         at org.apache.tiles.autotag.core.runtime.AbstractModelBody.evaluateAsString(AbstractModelBody.java:70)
>         at org.apache.tiles.template.PutAttributeModel.execute(PutAttributeModel.java:96)
>         at org.apache.tiles.jsp.taglib.PutAttributeTag.doTag(PutAttributeTag.java:226)
> What I did 
> 1. Declared a compiled Pattern
> private static Pattern pattern = Pattern.compile("^\\s*|\\s*$");
> 2. in evaluateAsString :
> pattern.matcher(body).replaceAll("");



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)