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: JAX-RS
    Affects Versions: 2.5.2
         Environment: Any
            Reporter: Matt Bishop
            Priority: Minor


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

        

Reply via email to