Bug 243588 - GC.drawPolyline() extremely slow when using non-solid line styles
Summary: GC.drawPolyline() extremely slow when using non-solid line styles
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-08 10:02 EDT by Howard Hellyer CLA
Modified: 2020-05-01 02:12 EDT (History)
5 users (show)

See Also:


Attachments
Test class for the line drawing performance problem. (3.06 KB, text/plain)
2008-08-08 10:08 EDT, Howard Hellyer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Howard Hellyer CLA 2008-08-08 10:02:22 EDT
We noticed a problem when using SWT to plot lines on a graph where the whole system, even the mouse pointer, would seem to freeze for a considerable time. After instrumenting our application we found that we were actually spending many seconds inside one call to org.eclipse.swt.graphics.GC.drawPolyline().

After further investigation it seems that when drawing a polyline with gc.setAdvanced(false) and the lineStyle set to something other than SWT.SOLID (for example SWT.LINE_DASH) the call to drawPolyline() takes a very long time to complete, I have been able to get it up to 10 seconds in my testcase (attached) but I have seen 200+ seconds when our application was instrumented to time the call. During that time nothing else can be drawn, the mouse pointer will not move and other windows will not update. Windows locks up and nothing redraws. The line draws faster and (more importantly) does not appear to block any other drawing if I call gc.setAdvanced(true) before drawing anything so for the moment I am using that to work around this issue.

This bug seems reasonably serious, the 200+ second pause I saw was for one re-paint. The user who reported the bug ended up having to reboot their system, possibly because they triggered more than one repaint operation.

I am seeing this on Windows XP with an ATI Mobility Radeon X1400 graphics card. The user who reported the bug also has an ATI graphics card so it's possible that this is an issue to do with the underlying graphics drivers. The bug does reproduce reliably on my system so if the testcase does not reproduce the symptom on another machine it would be worth checking what graphics card you are using and possibly trying on a different system. I have tested this on a Linux x86 box and it did not occur there either with our application or the testcase.

I have tried the testcase with the latest builds of SWT available here:
http://www.eclipse.org/swt/
and was able to reproduce the problem with both the 3.4 and the 3.3.2 builds.
Comment 1 Howard Hellyer CLA 2008-08-08 10:08:20 EDT
Created attachment 109520 [details]
Test class for the line drawing performance problem.

Changed gc.setAdvanced() to pass true to make the problem go away.
Comment 2 Silenio Quarti CLA 2008-08-08 10:39:29 EDT
Here is the output from the test running on my machine:

If setAdvanced is false the machine may be non-responsive while the styled lines are drawn.
The effect is more noticeable the larger the window is.
Try moving the mouse around while the image is being drawn on a maximised window.
First line complete.
First line took 63 milliseconds with 768 points and gc.setAdvanced(false)
Second line complete.
Second line took 47 milliseconds with 768 points and gc.setAdvanced(false)

If setAdvanced is false the machine may be non-responsive while the styled lines are drawn.
The effect is more noticeable the larger the window is.
Try moving the mouse around while the image is being drawn on a maximised window.
First line complete.
First line took 16 milliseconds with 768 points and gc.setAdvanced(true)
Second line complete.
Second line took 31 milliseconds with 768 points and gc.setAdvanced(true)

Comment 3 Steve Northover CLA 2008-08-08 12:55:44 EDT
From talking to Howard, it seems that GC.setLineWidth(1) causes the problem (ie. non-zero).
Comment 4 David Balažic CLA 2019-05-06 09:26:43 EDT
Any news here? I have the same symptoms since ages, until today.

It happens every time I start eclipse. It is worse if I start two instances at the same time. Then my mouse pointer freezes fro seconds at time. Also all gfx update in other apps freeze (like Firefox).

After Eclipse is up and running, the problem almost never arises.

Only gfx seems to be affected, music playing at the same time has no problems.
Also, there is high CPU load (up to 100%, on a multi core CPU) during this.


System details:
Eclipse 4.11.0  and 4.9.0
Java Oracle JDK
java.version=1.8.0_201
java.vm.info=mixed mode
java.vm.name=Java HotSpot(TM) 64-Bit Server VM

nVidia Quadro M1000M , driver 389.08
Intel HD 530, driver version 21.20.16.4821
(both are active, driving each own monitor, according to nVidia Control Panel)

Windows 7 Enterprise x64
CPU Intel i7-6820HQ

As mentioned, this problem persist for a long time, also on my previous PCs, so exact HW is probably not important.
Comment 5 Nikita Nemkin CLA 2019-05-23 11:30:38 EDT
(In reply to David  Balažic from comment #4)
> Any news here? I have the same symptoms since ages, until today.

David, it seems you've replied to the wrong bug.
Comment 6 David Balažic CLA 2019-05-23 11:33:23 EDT
No(In reply to Nikita Nemkin from comment #5)
> (In reply to David  Balažic from comment #4)
> > Any news here? I have the same symptoms since ages, until today.
> 
> David, it seems you've replied to the wrong bug.

No, it is the correct one.
Comment 7 Christoph Laeubrich CLA 2020-05-01 02:12:20 EDT
SWT-Chart also suffers from this bug.