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

Reduce overhead of normalizing file paths

XMLWordPrintable

    • b26

      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)).

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

              Created:
              Updated:
              Resolved: