Details

    • Type: Sub-task Sub-task
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 5.0M8
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None

      Description

      File.getCanonicalPath is very slow in Harmony, avoid to use it will significant improve performance when SecurityManager is installed.

      1. FilePermisson.diff
        6 kB
        Regis Xu
      2. FilePermission.v3.diff
        13 kB
        Regis Xu
      3. FilePermission.v2.diff
        12 kB
        Regis Xu

        Activity

        Hide
        Regis Xu added a comment -

        This patch still use getCanonicalPath on Linux, because I haven't found a better way to resolve symbol links on Linux, which did by getCanonicalPath.

        Show
        Regis Xu added a comment - This patch still use getCanonicalPath on Linux, because I haven't found a better way to resolve symbol links on Linux, which did by getCanonicalPath.
        Hide
        Regis Xu added a comment -

        I tested the performance of this patch with following simple benchmark:

        <code>
        public static void main(String[] args) throws IOException {
        System.setSecurityManager(new SecurityManager());
        File file = new File("FilePerTest.java");

        long start = System.currentTimeMillis();
        for (int i = 0; i < 40000; ++i)

        { file.isFile(); file.exists(); file.canRead(); }

        long end = System.currentTimeMillis();

        System.out.println("Time is: " + (end - start));
        }
        </code>

        I got results:

        before patch: 45954ms
        after patch: 14188ms

        Show
        Regis Xu added a comment - I tested the performance of this patch with following simple benchmark: <code> public static void main(String[] args) throws IOException { System.setSecurityManager(new SecurityManager()); File file = new File("FilePerTest.java"); long start = System.currentTimeMillis(); for (int i = 0; i < 40000; ++i) { file.isFile(); file.exists(); file.canRead(); } long end = System.currentTimeMillis(); System.out.println("Time is: " + (end - start)); } </code> I got results: before patch: 45954ms after patch: 14188ms
        Hide
        Regis Xu added a comment -

        This patch deal with Windows short name and network driver, also added some tests.
        I just tested on Windows, will try on Linux.

        Show
        Regis Xu added a comment - This patch deal with Windows short name and network driver, also added some tests. I just tested on Windows, will try on Linux.
        Hide
        Regis Xu added a comment -

        this patch is just a prototype, just tested on Windows, the value for Linux is still unknown.
        It didn't deal with win32 short name of path and network driver.

        comments/suggestions are welcome.

        Show
        Regis Xu added a comment - this patch is just a prototype, just tested on Windows, the value for Linux is still unknown. It didn't deal with win32 short name of path and network driver. comments/suggestions are welcome.

          People

          • Assignee:
            Unassigned
            Reporter:
            Regis Xu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development