Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3823

Do not use String.replaceAll

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.23.0
    • Component/s: None

      Description

      We use JDK's String.replaceAll(String regex, String replacement) about 60 times in the code, but most of these should probably use String.replace(CharSequence target, CharSequence replacement).

      replaceAll uses regex semantics, which is slow (it compiles a pattern each call) and probably not desired behavior.

      Consider adding to forbidden-apis/signatures.txt to prevent it from being accidentally used in future.

      See tweet "String.replaceAll is the most invisible java perf issue I end up finding out of profiles".

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              julianhyde Julian Hyde

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h
                2h

                  Issue deployment