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

Reduce overhead of normalizing file paths

    XMLWordPrintable

Details

    • 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

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

            Dates

              Created:
              Updated:
              Resolved: