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

OGL: improve performance of parameter queuing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 5.0
    • client-libs
    • 2d
    • b43
    • generic
    • solaris_9

      In our single-threaded OGL pipeline, we enqueue parameters for each rendering
      operation onto a java.nio.ByteBuffer. For example, a fillRect() operation
      currently looks like this:
          buf.putInt(FILL_RECT);
          buf.putInt(x).putInt(y).putInt(w).putInt(h);

      We have a number of operations whose parameters consist entirely of integers (no floats, longs, etc). For these operations we can exploit the fact that we always keep the current buffer position aligned on a 4-byte boundary, and therefore use an IntBuffer view on the original ByteBuffer to enqueue those
      int parameters. (In a microbenchmark, tested on both Solaris/SPARC and Linux,
      I found that using IntBuffer.put() can be up to 3x faster than
      ByteBuffer.putInt() when the buffer is in the native machine endianness.)
      So for the above example, we would instead use:
          IntBuffer ibuf = buf.asIntBuffer();
          ibuf.put(FILL_RECT);
          ibuf.put(x).put(y).put(w).put(h);
          buf.position(buf.position() + 20);
      ###@###.### 2005-05-20 00:09:21 GMT

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: