[
https://issues.apache.org/jira/browse/CXF-4134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Bishop reopened CXF-4134:
------------------------------
Thanks for your fast response Freeman!
You fixed one of the two problems. The remaining pattern to define statically
is inside the loop itself:
String[] encodings = headerLine.trim().split("[,\\s]*,\\s*");
Needs to be converted to a Pattern and reused:
static final Pattern ENCODINGS = Pattern.compile("[,\\s]*,\\s*");
Then in the loop:
String[] encodings = ENCODINGS.split(headerLine,trim());
> GZIPOutInterceptor compiles Patterns constantly; they should be compiled once
> and reused
> ----------------------------------------------------------------------------------------
>
> Key: CXF-4134
> URL: https://issues.apache.org/jira/browse/CXF-4134
> Project: CXF
> Issue Type: Improvement
> Components: Core, Transports
> Affects Versions: 2.5.2
> Environment: Any
> Reporter: Matt Bishop
> Assignee: Freeman Fang
> Priority: Minor
> Labels: perfomance
> Fix For: 2.3.10, 2.4.7, 2.5.3, 2.6
>
>
> GZIPOutInterceptor (lines 193 to 195) use two regular expressions to search
> for a pattern in a string. They compile the regex on every call, and on every
> pass through a loop:
> Pattern zeroQ = Pattern.compile(";\\s*q=0(?:\\.0+)?$");
> for (String headerLine : acceptEncodingHeader) {
> String[] encodings = headerLine.trim().split("[,\\s]*,\\s*");
> Compiling patterns is not cheap; please move these patterns (including the
> String.split() pattern) into the constructor or a static member so we don't
> keep recompiling the pattern.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira