You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Patrick Julien (JIRA)" <ji...@apache.org> on 2015/06/26 19:04:04 UTC

[jira] [Updated] (GROOVY-7478) Ability to Cache Patterns

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

Patrick Julien updated GROOVY-7478:
-----------------------------------
    Description: 
It seems {{InvokeHelper}} cannot cache the results of {{Pattern#compile}} at all when running embedded Groovy scripts.

When this is combined with regular expressions and a somewhat large number scripts, there is a very large hit to performance when these scripts need to be constantly run.

Using Java 8u40. and close to 10k scripts, the same 10k scripts are properly cached and reused but {{Pattern}} objects are constantly re-compiled.

I am using a {{ConcurrentHashMap}} from a custom implementation of {{InvokeHelper}} at the moment to workaround the problem but having a supported way of controlling this behavior would be welcomed.



  was:
It seems {{InvokeHelper}} cannot cache the results of {{Pattern#compile}} at all when running embedded Groovy scripts.

When this is combined with regular expressions and a somewhat large number scripts, there is a very large hit to performance when these scripts need to be constantly run.

Using Java 8u40. and close to 10k scripts, the same 10k scripts are properly cached and reused but {{Pattern}} objects are constantly re-compiled.

I am using a {{ConcurrentHashMap}} at the moment to workaround the problem but having a supported way of controlling this behavior would be welcomed.




> Ability to Cache Patterns
> -------------------------
>
>                 Key: GROOVY-7478
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7478
>             Project: Groovy
>          Issue Type: New Feature
>          Components: class generator
>    Affects Versions: 2.3.9, 2.4.3
>            Reporter: Patrick Julien
>            Priority: Minor
>
> It seems {{InvokeHelper}} cannot cache the results of {{Pattern#compile}} at all when running embedded Groovy scripts.
> When this is combined with regular expressions and a somewhat large number scripts, there is a very large hit to performance when these scripts need to be constantly run.
> Using Java 8u40. and close to 10k scripts, the same 10k scripts are properly cached and reused but {{Pattern}} objects are constantly re-compiled.
> I am using a {{ConcurrentHashMap}} from a custom implementation of {{InvokeHelper}} at the moment to workaround the problem but having a supported way of controlling this behavior would be welcomed.



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