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

ImageIO write from remote display too slow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 5.0
    • client-libs
    • None

      A customer encounters a performance problem with ImageIO.
      Using the attached test case, here the time it takes to write an image
      to a file (PNG):

        local display -> DISPLAY set to :0
        remote display -> DISPLAY set to remote machine:0

                        local display remote display
        jdk1.5.0_04 ~3 sec ~36 min
        jdk1.4.2_08 ~3 sec ~39 min


      pstack shows the following:

        ...
        b2bc047c XGetImage (1c4128, e0002f, 2e2, 4d, 1, 1) + a0
        fde27ea0 ???????? (fde75940, 2a36a8, ffbfd9c0, 1, 0, 20) + 4b267ac4
        fde27c38 ???????? (37618, 2a36a8, ffbfd9c0, 1c6170, 1, 3c4) + 4b26785c
        b30f5d44 Java_sun_awt_image_DataBufferNative_getElem (37618, ffbfda98, 2e2, 4d, ffbfda94, 2a36a8) + 64
        f8850798 * *sun/awt/image/DataBufferNative.getElem(IILsun/java2d/SurfaceData;)I+0
        f8850c10 * sun/awt/image/IntegerInterleavedRaster.verify(Z)V+432 (line 551)
        f8851720 * *java/awt/image/SinglePixelPackedSampleModel.getDataElements(IILjava/lang/Object;Ljava/awt/image/DataBuffer;)Ljava/lang/Object;+196 (line 404)
        f8857404 * *java/awt/image/SampleModel.getDataElements(IIIILjava/lang/Object;Ljava/awt/image/DataBuffer;)Ljava/lang/Object;+369 (line 402)
         ...


      I tracked down (jdk1.5.0_04 src) to the following call where
      getDataElements is eventually called for each pixel. In the remote case,
      it further translates to XGetImage call per pixel, which could be
      the cause for bad performance:


      SampleModel:
      334 public Object getDataElements(getDataElements(int x, int y, int w, int h,
      335 Object obj, DataBuffer data) {:
      ....

      400 for (int i=y; i<y+h; i++) {
      401 for (int j=x; j<x+w; j++) {
      402 o = getDataElements(j, i, o, data);
      403 itemp = (int[])o;
      404 for (int k=0; k<numDataElems; k++) {
      405 idata[cnt++] = itemp[k];
      406 }
      407 }

            campbell Christopher Campbell (Inactive)
            lkchow Lawrence Chow
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: