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

Performance: sun.awt.X11GraphicsEnvironment should use buffered s=

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • 2d
    • generic
    • generic



      Name: clC74495 Date: 07/26/99

      =20
      java version "1.2.2", running under solaris.


      During initialization of the X11GraphicsEnvironment all
      X11 font directories installed on a given system are located
      and the "fonts.dir" file located in each of these directories
      is read. These "fonts.dir" files are read using unbuffered
      reads. The streams should be buffered.

      Run the test case below with truss, note the huge amount of
      read system calls (wasting a lot of time):

      truss -c /opt/jdk1.2.2/bin/java font
      signals ------------
      SIGALRM 3
      SIGCLD 7
      SIGLWP 1
      total: 11

      syscall seconds calls errors
      _exit .00 1
      fork .00 8
      read 2.48 28869 1
      write .00 4
      open .06 642 65
      close .03 594 2
      unlink .00 1
      time .00 6
      brk .02 145
      stat .01 27 11
      lseek .00 60
      getpid .00 5
      getuid .00 4
      fstat .00 64
      access .02 264 229
      dup .00 2
      pipe .00 7
      getgid .00 2
      ioctl .00 65 58
      execve .00 2
      fcntl .01 41
      poll 1.12 721
      sigprocmask .00 68
      sigaltstack .00 16
      sigaction .00 101
      sigpending .00 1
      context .00 12
      waitid .00 29 21
      pathconf .00 1
      mmap .00 132
      mprotect .03 30
      munmap .00 39
      readv .00 11 1
      writev .00 4
      setrlimit .00 1
      getrlimit .00 3
      uname .00 4
      sysconfig .00 7
      sysinfo .00 2
      lwp_sema_wai .00 90 3
      lwp_sema_pos .00 87
      setitimer .00 27
      lwp_create .00 12
      lwp_suspend .00 1
      lwp_continue .00 6
      lwp_kill .00 1
      lwp_self .00 9
      lwp_mutex_wa .00 40
      lwp_mutex_lo .00 54
      lwp_cond_wai .00 3
      lwp_cond_sig .00 2
      lwp_cond_bro .00 1
      llseek .06 1019 7
      door .00 9
      lwp_schedctl .00 9
      resolvepath .00 18 4
      getdents64 .00 2
      stat64 .00 10 1
      lstat64 .00 4
      fstat64 .00 66
      open64 .00 7
                      ---- --- ---
      sys totals: 3.84 33472 403
      usr time: 2.24
      elapsed: 8.53




      With my suggested fix installed, the truss output shows a
      huge decrease in the number of read system calls performed:

      syscall seconds calls errors
      _exit .00 1
      fork .00 8
      read .06 571 1
      ...
                      ---- --- ---
      sys totals: .69 4739 633
      usr time: 1.85
      elapsed: 3.08


      (My fix also adds an explicit close for the "fonts.dir" stream
      to release the unix file descriptor before the stream is gc'ed)

      TEST CASE:
      public class font {
          public static void main(String[] args) {
              new java.awt.Font("dialog", java.awt.Font.BOLD, 10);
              System.exit(0);
          }
      }
      (Review ID: 88171)=20
      ======================================================================

            Unassigned Unassigned
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: