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

Do not use String.replaceAll

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.23.0
    • 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

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              julianhyde Julian Hyde
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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