Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8537

Replace String.replaceAll with substring for better throughput performance

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.10
    • Fix Version/s: 3.4.4, 3.5.0
    • Component/s: JAX-RS
    • Labels:
      None
    • Environment:

      This would affect all platforms.

    • Estimated Complexity:
      Unknown

      Description

      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;

       

        Attachments

          Activity

            People

            • Assignee:
              ffang Freeman Yue Fang
              Reporter:
              joshuad Joshua Dettinger
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: