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

Reduce overhead of normalizing file paths

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 15
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b26

      Description

      UnixFileSystem.normalize can be simplified to this:

          public String normalize(String pathname) {
              int doubleSlash = pathname.indexOf("//");
              if (doubleSlash >= 0) {
                  return normalize(pathname, doubleSlash);
              }
              if (pathname.endsWith("/")) {
                  return normalize(pathname, pathname.length() - 1);
              }
              return pathname;
          }

      .. which is more efficient overall, especially so during startup/warmup (to the tune of a couple of us/op on new File(path)).

        Attachments

          Activity

            People

            Assignee:
            redestad Claes Redestad
            Reporter:
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: