You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Joshua Dettinger (Jira)" <ji...@apache.org> on 2021/05/05 18:06:00 UTC

[jira] [Created] (CXF-8537) Replace String.replaceAll with substring for better throughput performance

Joshua Dettinger created CXF-8537:
-------------------------------------

             Summary: Replace String.replaceAll with substring for better throughput performance
                 Key: CXF-8537
                 URL: https://issues.apache.org/jira/browse/CXF-8537
             Project: CXF
          Issue Type: Improvement
          Components: JAX-RS
    Affects Versions: 3.3.10
         Environment: This would affect all platforms.
            Reporter: Joshua Dettinger
             Fix For: 3.4.4


Sometime in the JAX-RS 3.3.x branch, the method org.apache.cxf.jaxrs.utils.JAXRSUtils.combineUriTemplates was introduced. This method calls a costly String.replaceAll in order to remove a '/' character at the end of a uri. This method can perform up to 2% better in throughput scenarios by changing:



return parent.replaceAll("/$", "") + child;

to

return parent.substring(0, parent.length() - 1) + child;

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)