Skip to main content

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

In most cases a Canvas doesn't even have 1 million visible pixels.  So
drawing as many lines probably isn't what you want to do. But, without
knowing exactly what you are doing, I am only guessing that there are some
optimizations potentially available at the client.  There are
caching/update strategies if you can't avoid painting so many lines.

Avoiding significant amounts of native code was an original design goal of
SWT.  It was pretty much "the law".  I believe this restriction has some
exceptions, perhaps for loading JPGs or something.  I don't velieve JNI was
the gating factor in those cases. Anyway, adding some more "meaty" native
methods that *duplicate* (ok, aggregate) existing API would probably be
taking SWT into uncharted territory.

You might want to open a bugzilla at this point to discuss both the
problem/possible solution, but also available workarounds (perhaps check
the newsgroups for this too).

-Randy Hudson



                                                                           
             Paul Anderson                                                 
             <paul-anderson@nl                                             
             .ibm.com>                                                  To 
                                       "Eclipse Platform SWT component     
             12/28/2006 11:06          developers list."                   
             AM                        <platform-swt-dev@xxxxxxxxxxx>      
                                                                        cc 
                                       Randy Hudson/Raleigh/IBM@IBMUS      
                                                                   Subject 
                                       Re: [platform-swt-dev] SWT          
                                       Performance suggestion              
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Randy,
      I agree, explicit end user locking could be cleaner/easier, I'm sure
it could be given a sufficient enough health warning to make people aware
of the dangers. In my particular case I would still pay 1,000,000 x the JNI
costs.

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)


|---------+------------------------------------>
|         |           Randy Hudson             |
|         |           <hudsonr@xxxxxxxxxx>     |
|         |           Sent by:                 |
|         |           platform-swt-dev-bounces@|
|         |           eclipse.org              |
|         |                                    |
|         |                                    |
|         |           12/28/2006 04:52 PM      |
|         |           Please respond to        |
|         |           "Eclipse Platform SWT    |
|         |           component developers     |
|         |           list."                   |
|---------+------------------------------------>

>--------------------------------------------------------------------------------------------------------------------------------------------------|

  |
|
  |       To:       "Eclipse Platform SWT component developers list."
<platform-swt-dev@xxxxxxxxxxx>
|
  |       cc:
|
  |       Subject:  Re: [platform-swt-dev] SWT Performance suggestion
|
  |
|
  |
|

>--------------------------------------------------------------------------------------------------------------------------------------------------|




It would be ideal if everyone could benefit from better lock/unlock
strategy without moving to some new API. Perhaps some creative, lazy unlock
approach might help?
Or, maybe adding API GC.lock() and GC.unlock(), and continue using all of
the existing calls?

-Randy




             Paul Anderson
             <paul-anderson@nl
             .ibm.com>                                                  To
             Sent by:                  platform-swt-dev@xxxxxxxxxxx
             platform-swt-dev-                                          cc
             bounces@eclipse.o
             rg                                                    Subject
                                       [platform-swt-dev] SWT Performance
                                       suggestion
             12/28/2006 09:41
             AM


             Please respond to
             "Eclipse Platform
               SWT component
             developers list."
             <platform-swt-dev
               @eclipse.org>







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)

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev






Back to the top