Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] SWT Performance suggestion

Hi All,
      I'm embarking on creating a graphical tool and have chosen to base it
on SWT, performance will be very important as the display may contain up to
a million lines. In my early experimentation I profiled some code and
noticed that before and after each native call to a graphic primitive such
as _gdk_draw_line there is a Lock.lock and Lock.unlock.

      Would it be possible to add to SWT a new drawing method that allows
me to construct an array of ints that represent a list of drawing
instructions that are sent in there entirety down to the native code for
execution, therefore eliminating the repeated thunking, locks/unlocks and
JNI round trips, there maybe also efficiencies to be had in the native
code. For example:



                  int[] drawList = new int[19];
                  int index=0;

                  drawlist[index++] = SWT.DRAW_LINE;
                  drawlist[index++] = 0;
                  drawlist[index++] = 0;
                  drawlist[index++] = 100;
                  drawlist[index++] = 100;
                  drawlist[index++] = SWT.SET_FOREGROUND;
                  drawlist[index++] = 255;
                  drawlist[index++] = 255;
                  drawlist[index++] = 255;
                  drawlist[index++] = SWT.DRAW_LINE;
                  drawlist[index++] = 0;
                  drawlist[index++] = 100;
                  drawlist[index++] = 100;
                  drawlist[index++] = 0;
                  drawlist[index++] = SWT.DRAW_LINE;
                  drawlist[index++] = 100;
                  drawlist[index++] = 100;
                  drawlist[index++] = 0;
                  drawlist[index++] = 100;


                  GC.drawList(drawList);



Paul Anderson
IBM Systems and Technology Group Lab Services
Home Office:+31-20-513-7388, Home Office:+31-70-362-9501,
Mobile:+31-651788098, paul-anderson@xxxxxxxxxx

Try Gentoo Linux (www.gentoo.org)



Back to the top