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

Font directories are read without buffering during AWT installation

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.3.0
    • client-libs
    • None
    • 2d
    • generic
    • solaris_7

      Running "truss" on a trivial AWT program shows that the system font directory
      files such as /usr/openwin/lib/X11/fonts/Type1/fonts.dir and /usr/openwin/lib/locale/iso_8859_*/X11/fonts/TrueType/fonts.dir are
      read using a system call per byte. This is most likely due to the use of
      a FileInputStream or other unbuffered interface in Java. This
      results in an unnecessary increase in application startup time and is
      easily fixed by using a BufferedInputStream.

      The program is as follows:

      import java.awt.Frame;

      public class InitBug {

          public static void main(String[] args) {
              Frame f = new Frame("InitBug");
              f.pack();
              f.setVisible(true);
          }
      }

      A short excerpt from the truss output:

      access("/usr/openwin/lib/X11/fonts/Type1/fonts.dir", 4) = 0
      open("/usr/openwin/lib/X11/fonts/Type1/fonts.dir", O_RDONLY|O_LARGEFILE) = 21
      fstat(21, 0xFFBECB80) = 0
      fcntl(21, F_GETFL, 0x00000000) = 8192
      fstat64(21, 0xFFBEC8E0) = 0
      fstat64(21, 0xFFBEC948) = 0
      fcntl(21, F_SETFL, 0x00002080) = 0
      ioctl(21, I_SETSIG, S_INPUT|S_HIPRI|S_OUTPUT|S_HANGUP) Err#25 ENOTTY
      sigprocmask(SIG_BLOCK, 0xFFBECA40, 0xFFBECA30) = 0
      sigprocmask(SIG_SETMASK, 0xFFBECA30, 0x00000000) = 0
      read(21, " 1", 1) = 1
      read(21, " 7", 1) = 1
      read(21, "\n", 1) = 1
      read(21, " U", 1) = 1
      read(21, " T", 1) = 1
      read(21, " R", 1) = 1
      read(21, " G", 1) = 1
      read(21, " _", 1) = 1
      read(21, " _", 1) = 1
      read(21, " _", 1) = 1
      read(21, " _", 1) = 1
      read(21, " .", 1) = 1
      read(21, " p", 1) = 1
      read(21, " f", 1) = 1
      ...

            Unassigned Unassigned
            dricesunw Daniel Rice (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: