Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT painting performance(Dashed lines are painted much slower than solid lines)
SWT painting performance [message #508097] Fri, 15 January 2010 21:40 Go to next message
Alex Boyko is currently offline Alex Boyko
Messages: 200
Registered: July 2009
Senior Member
We have a performance issue in Draw2D (Eclipse\GEF) with painting lines with dash pattern.

Draw2D is well optimized to paint only regions of the canvas that should be painted.

The problem:
A GEF diagram has a lot of lines painted (links between nodes). Lines are drawn with GC#drawPolyline(...) method. Antialias and advanced graphics are set to "ON" on the GC. Scrolling a diagram with solid lines works well. Scrolling a diagram with non-solid lines (LINE_DOT) works very slow.
Profiling has shown that most of the time is spent in gdip draw lines native method.

Measuring the time of each GC#drawPolyline(...) call has shown that many times for a solid line this method takes 0 time to execute, while for non-solid line it returned some non-zero time (15ms) much more often.
I'm guessing that there is some caching happening in the native code, so paint calls sometime don't take any execution time, and take time only when something does need a repaint.

I wonder now why the non-solid line is repainted more than 10 times more often than the solid line? Is this reasonable? Can this be improved in SWT?

Thanks in advance.

Cheers,
Alex
Re: SWT painting performance [message #508597 is a reply to message #508097] Tue, 19 January 2010 15:14 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
Hi,

We were not aware of this performance issue. Looking at swt's win32
implementation of GC.drawPolyline(), it's basically just three gdip calls
when advanced graphics is turned on, so the time is being spent in gdip. I
don't think there's anything swt can do about this. If possible, you can
see if turning off advanced graphics makes this perform faster.

As a side note, there's a new Direct X library available as of Windows 7
which should have better performance than gdip. swt's advanced graphics
support on win32 could be enhanced in a future release to use this library
instead if it's available.

Grant


"Alex Boyko" <aboyko@ca.ibm.com> wrote in message
news:hiqnd1$2lv$1@build.eclipse.org...
> We have a performance issue in Draw2D (Eclipse\GEF) with painting lines
with dash pattern.
>
> Draw2D is well optimized to paint only regions of the canvas that should
be painted.
>
> The problem:
> A GEF diagram has a lot of lines painted (links between nodes). Lines are
drawn with GC#drawPolyline(...) method. Antialias and advanced graphics are
set to "ON" on the GC. Scrolling a diagram with solid lines works well.
Scrolling a diagram with non-solid lines (LINE_DOT) works very slow.
> Profiling has shown that most of the time is spent in gdip draw lines
native method.
>
> Measuring the time of each GC#drawPolyline(...) call has shown that many
times for a solid line this method takes 0 time to execute, while for
non-solid line it returned some non-zero time (15ms) much more often.
> I'm guessing that there is some caching happening in the native code, so
paint calls sometime don't take any execution time, and take time only when
something does need a repaint.
>
> I wonder now why the non-solid line is repainted more than 10 times more
often than the solid line? Is this reasonable? Can this be improved in SWT?
>
> Thanks in advance.
>
> Cheers,
> Alex
>
Re: SWT painting performance [message #508628 is a reply to message #508597] Tue, 19 January 2010 16:35 Go to previous message
Alex Boyko is currently offline Alex Boyko
Messages: 200
Registered: July 2009
Senior Member
Thanks for the reply.
When is SWT planning to add support for Windows 7 DirectX? Would that be 3.6?

Thanks!

Cheers,
Alex
Re: SWT painting performance [message #508691 is a reply to message #508628] Tue, 19 January 2010 16:14 Go to previous message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
Hi,

It won't be in 3.6, it's too late in the cycle to initiate a new work item
of this size. And since picking of post-3.6 plan items has not begun yet, I
can't say for sure when it will be done. I don't think there's an existing
request for this though, so I would suggest logging a feature request with
swt at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT&bug_severity=enhancement .
Also, watch for plans for future releases, as a work item of this size would
probably appear on a formal plan.

Grant


"Alex Boyko" <aboyko@ca.ibm.com> wrote in message
news:hj4n11$4ks$1@build.eclipse.org...
> Thanks for the reply.
> When is SWT planning to add support for Windows 7 DirectX? Would that be
3.6?
>
> Thanks!
>
> Cheers,
> Alex
Previous Topic:How to serialize an SWT Image
Next Topic:Many browser widgets in many threads
Goto Forum:
  


Current Time: Tue Oct 21 16:53:00 GMT 2014

Powered by FUDForum. Page generated in 0.01824 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software