Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8222806

Inefficient String.replace in PathFileObject.toBinaryName

    Details

    • Type: Enhancement
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:

      Description

      PathFileObject.toBinaryName() uses String.replace(String, String), which is profiling at 3x the cost of String.replace(char, char) on my machine. Switching to use the primitive version where possible saves ~300ms in a 30s compilation, or about 1%.

      FileSystem.getSeperator() isn't guaranteed to return a single-character separator, but a simple check can satisfy all cases while still being optimal for single-character separators.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ronsh Ron Shapiro
                Reporter:
                ronsh Ron Shapiro
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: