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

Reduce prism-es2 memory footprint

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • 7u6
    • fx2.1
    • javafx
    • Mac and Linux

      The memory footprint question was brought up in this morning meeting. So here is a short analysis I have put together to help us better understand what we have achieved and what can be improved on the prism-es2 pipe in term of memory footprint reduction.

      Here is the breakdown of prism-es2 related native libraries and jars (note that prism-util.jar is also used by prism-d3d)

      Current in my workspace:
      -rw-r--r-- 1 cyang staff 407152 Dec 13 13:06 artifacts/sdk/build/lib/desktop/libprism-es2.jnilib
      -rw-r--r-- 1 cyang staff 38135 Dec 13 13:06 artifacts/sdk/build/lib/desktop/prism-es2-mac.jar
      -rw-r--r-- 1 cyang staff 274694 Dec 13 13:06 artifacts/sdk/build/lib/desktop/prism-es2.jar
      -rw-r--r-- 1 cyang staff 55166 Dec 13 13:06 artifacts/sdk/build/lib/desktop/prism-util.jar

      55166 + 407152 + 38135 + 274694
      =775147 bytes (uncompressed)

      jfx-202:
      -rw-r--r-- 1 cyang staff 493928 Nov 10 08:50 202/jfx/artifacts/sdk/build/lib/desktop/libprism_jogl_gl2.jnilib
      -rw-r--r-- 1 cyang staff 24800 Nov 10 08:50 202/jfx/artifacts/sdk/build/lib/desktop/libprism_nativewindow_jvm.jnilib
      -rw-r--r-- 1 cyang staff 29688 Nov 10 08:50 202/jfx/artifacts/sdk/build/lib/desktop/libprism_nativewindow_util.jnilib
      -rw-r--r-- 1 cyang staff 143151 Nov 10 08:55 202/jfx/artifacts/sdk/build/lib/desktop/prism-es2.jar
      -rw-r--r-- 1 cyang staff 278994 Nov 10 08:50 202/jfx/artifacts/sdk/build/lib/desktop/prism-jogl-common.jar
      -rw-r--r-- 1 cyang staff 123792 Nov 10 08:50 202/jfx/artifacts/sdk/build/lib/desktop/prism-jogl-glu.jar
      -rw-r--r-- 1 cyang staff 40836 Nov 10 08:52 202/jfx/artifacts/sdk/build/lib/desktop/decora-ogl.jar

      143151 + 278994 + 123792 + 493928 + 24800 + 29688 + 40836
      =1135189 bytes (uncompressed)

      Percentage reduction: ~ 32%
      Reduced # of native libraries: 2
      Reduced # of packages: 1

      There is still room where we can further reduce the memory footprint by possibly 50% simply by trimming away unused GL binding methods (in Java and in native). This is a relative safe work which is best to wait till we have a functional X11 port.

      Listing of the top 5 largest files in prism-es2 projects:

      prism-es2
           525 ./GLCapabilities.java
           880 ./GL.java
          1076 ./GL2GL3.java
          2669 ./GL2.java
          6323 ./impl/gl2/GL2Impl.java
         18226 total

      prism-es2-mac
           248 ./src/com/sun/prism/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
           274 ./src/com/sun/prism/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
           324 ./src/com/sun/prism/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
           335 ./src/com/sun/prism/opengl/impl/macosx/cgl/MacOSXCGLContext.java
           539 ./src/com/sun/prism/opengl/impl/macosx/cgl/CGL.java
          2679 total

      prism-es2-native
           792 ./src/macosx/CGL_JNI.c
          1269 ./src/x11/GLX_JNI.c
          1585 ./src/windows/WGLExtImpl_JNI.c
          1661 ./src/x11/GLXExtImpl_JNI.c
          8174 ./src/GL2Impl_JNI.c
         15458 total

            ckyang Chien Yang (Inactive)
            ckyang Chien Yang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: