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

Toolkit.getImage(URL) function call is very slow on OS X compare to Linux and Windows

    Details

    • Subcomponent:
    • Introduced In Version:
      8
    • CPU:
      x86_64
    • OS:
      os_x

      Description

      ADDITIONAL SYSTEM INFORMATION :
      macOS High Sierra version 10.13.4 with java 10.0.1

      A DESCRIPTION OF THE PROBLEM :
      On Linux, the first time Toolkit.getImage(URL) is called with a fresh URL, takes only 16ms, while on OS X, it takes 1600ms. On subsequence run and call of the same (probably cached) URL, takes 1ms on Linux, but 300+ms on OS X

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      On both linux (I have Fedora 27 with updates) and Mac OS, compile the attached source code. Run the program with "java test.Test" several times (assuming CLASSPATH is set).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Mac OS version should be just as fast as the Linux version.
      ACTUAL -
      The Mac OS is 100 times slower than on Linux.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.awt.*;
      import java.net.*;

      public class Test {
        public static void main(String[] args) throws Exception {
          String s = "https://upload.wikimedia.org/wikipedia/commons/9/95/Big_Pine_landscape.jpg";
          URL u = new URL(s);
          Toolkit t = Toolkit.getDefaultToolkit();
          long b = System.currentTimeMillis();
          Image i = t.getImage(u);
          System.out.println("got image in " + (System.currentTimeMillis() - b) + "ms");
        }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serb Sergey Bylokhov
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: