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


I would be interested in seeing a benchmark before doing any work in this area.  Please construct one and enter a bug report.



Paul Anderson <paul-anderson@xxxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

12/30/2006 05:55 AM

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

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





Randy,

     I've been thinking, Would a "batch" capability on the GC be an even
better solution, taking JDBC as an analogy one could:

           gc.setAutoCommit(false);

                 // which sets an internal boolean flag in the gc and
creates a default sized int array for the instructions

           gc.drawLine(0,0,100,100);
           ...
           ...

                 // would within the GC
                 //   drawlist[index++] = SWT.DRAW_LINE;
                 //  drawlist[index++] = 0;
                 //  drawlist[index++] = 0;
                 //  drawlist[index++] = 100;
                 //  drawlist[index++] = 100;
                 // the same follows for most in not all calls to draw
primitives

           gc.commit();

                 // would pass the entire int array to a new native method
that executes the draw instructions


     I'm sure that there would be a way to flush instructions catching the
case where the commit is errantly not called, maybe on the dispose or piggy
backing on a timed.

Paul Anderson
IBM Systems and Technology Group Lab Services

Try Gentoo Linux (www.gentoo.org)


|---------+------------------------------------>
|         |           Paul                     |
|         |           Anderson/Netherlands/IBM@|
|         |           IBMNL                    |
|         |           Sent by:                 |
|         |           platform-swt-dev-bounces@|
|         |           eclipse.org              |
|         |                                    |
|         |                                    |
|         |           12/29/2006 01:24 AM      |
|         |           Please respond to        |
|         |           "Eclipse Platform SWT    |
|         |           component developers     |
|         |           list."                   |
|---------+------------------------------------>
 >--------------------------------------------------------------------------------------------------------------------------------------------------|
 |                                                                                                                                                  |
 |       To:       "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>                                                 |
 |       cc:       "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>, platform-swt-dev-bounces@xxxxxxxxxxx           |
 |       Subject:  Re: [platform-swt-dev] SWT Performance suggestion                                                                                |
 |                                                                                                                                                  |
 |                                                                                                                                                  |
 >--------------------------------------------------------------------------------------------------------------------------------------------------|



Randy,
     "Clicks" for calling me on the Million drawLines, my expectation is
~10,000 per frame but I want a fairly high frame rate. As I work in Java
perfomance the lock/unlock looked like an obvious target.

     Although the data set I wish to draw will often contain over 400M
lines there are clearly optimisations around scale and visibility that can
be exploited, these given, I wish to be confident that I can deliver the
end user experience required.

     I have been playing with the often referenced SWT/RCP based
applications, i.e. Azureus, and found the SWT/Cairo/XGL performance
generally excellent, however on the  Azureus Tools->Statistics->Vivaldi
canvas the draw speed seemed to be ~500ms, my guess is that a drawList
would drop this to <100ms.

     I'll go off and write a drawList function and time the difference, if
it is pretty for my case and a few others then maybe SWT could consider
inclusion.



Paul Anderson
IBM Systems and Technology Group
Client Technology Center for Lab Services
EMEA ATS e-Business Solutions Center (eBSC),  Netherlands
Home Office:+31-20-513-7388, Home Office:+31-70-362-9501,
Mobile:+31-651788098, paul-anderson@xxxxxxxxxx

internet: www.ibm.com/eserver/services
intranet: w3is.lge.fr.ibm.com/eBSC/CTC, web.mainz.de.ibm.com/ATSservices

Try Gentoo Linux (www.gentoo.org)


|---------+------------------------------------>
|         |           Randy Hudson             |
|         |           <hudsonr@xxxxxxxxxx>     |
|         |           Sent by:                 |
|         |           platform-swt-dev-bounces@|
|         |           eclipse.org              |
|         |                                    |
|         |                                    |
|         |           12/28/2006 06:08 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
|
 |
|
 |
|

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




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




_______________________________________________
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


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


Back to the top