You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "David Hay (JIRA)" <ji...@apache.org> on 2010/09/20 21:00:37 UTC
[jira] Created: (FELIX-2605) FilterHandler should pre-compile
regular expression
FilterHandler should pre-compile regular expression
---------------------------------------------------
Key: FELIX-2605
URL: https://issues.apache.org/jira/browse/FELIX-2605
Project: Felix
Issue Type: Improvement
Components: HTTP Service
Affects Versions: http-2.0.4
Reporter: David Hay
Attachments: FilterHandler.java-regexp.patch
The implementation of FilterHandler has a potential performance problem. Each time the "handle" method is called, it goes through a matching process that includes the following code:
return uri.matches(this.pattern)
The problem is that this compiles the regular expression every time this method is called, a potentially expensive operation.
The pattern should be compiled using Pattern.compile and then re-used for each call to "matches" as follows:
return this.regex.matcher(uri).matches();
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (FELIX-2605) FilterHandler should pre-compile
regular expression
Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler reassigned FELIX-2605:
---------------------------------------
Assignee: Carsten Ziegeler
> FilterHandler should pre-compile regular expression
> ---------------------------------------------------
>
> Key: FELIX-2605
> URL: https://issues.apache.org/jira/browse/FELIX-2605
> Project: Felix
> Issue Type: Improvement
> Components: HTTP Service
> Affects Versions: http-2.0.4
> Reporter: David Hay
> Assignee: Carsten Ziegeler
> Attachments: FilterHandler.java-regexp.patch
>
>
> The implementation of FilterHandler has a potential performance problem. Each time the "handle" method is called, it goes through a matching process that includes the following code:
> return uri.matches(this.pattern)
> The problem is that this compiles the regular expression every time this method is called, a potentially expensive operation.
> The pattern should be compiled using Pattern.compile and then re-used for each call to "matches" as follows:
> return this.regex.matcher(uri).matches();
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (FELIX-2605) FilterHandler should pre-compile
regular expression
Posted by "David Hay (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Hay updated FELIX-2605:
-----------------------------
Attachment: FilterHandler.java-regexp.patch
Attaching a patch file that implements the proposed solution.
> FilterHandler should pre-compile regular expression
> ---------------------------------------------------
>
> Key: FELIX-2605
> URL: https://issues.apache.org/jira/browse/FELIX-2605
> Project: Felix
> Issue Type: Improvement
> Components: HTTP Service
> Affects Versions: http-2.0.4
> Reporter: David Hay
> Attachments: FilterHandler.java-regexp.patch
>
>
> The implementation of FilterHandler has a potential performance problem. Each time the "handle" method is called, it goes through a matching process that includes the following code:
> return uri.matches(this.pattern)
> The problem is that this compiles the regular expression every time this method is called, a potentially expensive operation.
> The pattern should be compiled using Pattern.compile and then re-used for each call to "matches" as follows:
> return this.regex.matcher(uri).matches();
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (FELIX-2605) FilterHandler should pre-compile
regular expression
Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler resolved FELIX-2605.
-------------------------------------
Fix Version/s: http-2.0.6
Resolution: Fixed
Thanks for your patch, David, I've applied a slightly modified version in revision: 999261
> FilterHandler should pre-compile regular expression
> ---------------------------------------------------
>
> Key: FELIX-2605
> URL: https://issues.apache.org/jira/browse/FELIX-2605
> Project: Felix
> Issue Type: Improvement
> Components: HTTP Service
> Affects Versions: http-2.0.4
> Reporter: David Hay
> Assignee: Carsten Ziegeler
> Fix For: http-2.0.6
>
> Attachments: FilterHandler.java-regexp.patch
>
>
> The implementation of FilterHandler has a potential performance problem. Each time the "handle" method is called, it goes through a matching process that includes the following code:
> return uri.matches(this.pattern)
> The problem is that this compiles the regular expression every time this method is called, a potentially expensive operation.
> The pattern should be compiled using Pattern.compile and then re-used for each call to "matches" as follows:
> return this.regex.matcher(uri).matches();
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.