This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 432826 - slow setTaskName on ProgressbarDialog on Linux and even worse on OSX
Summary: slow setTaskName on ProgressbarDialog on Linux and even worse on OSX
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Brian de Alwis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 436358
  Show dependency tree
 
Reported: 2014-04-15 10:07 EDT by Max Rydahl Andersen CLA
Modified: 2014-06-02 10:39 EDT (History)
7 users (show)

See Also:


Attachments
YourKit trace report (179.08 KB, image/png)
2014-04-22 10:39 EDT, Brian de Alwis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max Rydahl Andersen CLA 2014-04-15 10:07:03 EDT
Why is ProgressbarDialog so noticably slower on OSX and slightly slower on Linux compared to Windows ?

After some testing I created https://github.com/maxandersen/broken-progressbar

Which is nothing but the jface ProgressDialog example modified to use setTaskName.

Here are three videos showing the difference across the platform:

OSX: 50 seconds - http://screencast.com/t/DhqW9lU3md5

Linux: a few seconds - http://youtu.be/J35JJOcxYWw

Windows: Almost instant - http://screencast.com/t/0IHIxx6MrQUv


Also notice that Cancel does not work - it as if the event for cancel is never registered.

This means we simply can't use progressdialogbar for telling the user what is going on in i.e. a copy operation what files are being copied since it simply blocks OSX UI.

This is reproducible on several years of eclipse releases so its not a new issue, but finally got around to reduce it to the simplest testcase.

Any idea ?
Comment 1 Brian de Alwis CLA 2014-04-22 10:39:00 EDT
Created attachment 242193 [details]
YourKit trace report

I traced this under YourKit and have attached the call time report on setTaskName().  The problem seems to be something to do with the Cocoa and Label's implementation.
Comment 2 Max Rydahl Andersen CLA 2014-04-22 11:37:59 EDT
What is weird is subTask() also uses a label afaik and that is not slowing things down at all.
Comment 3 Brian de Alwis CLA 2014-04-22 11:54:12 EDT
I should have done more digging.

The problem is ProgressMonitorDialog/AccumulatingProgressMonitor.  PMD uses a JFace AccumulatingProgressMonitor to accumulate changes so as to avoid bombarding SWT with label & progress bar changes (while an asyncExec is pending, it just updates its internal values).  APM doesn't accumulate task-name changes and instead causes those to be pushed out directly to SWT. So every task-name change is being blasted out.

Typically callers aren't expected to call setTaskName() and just use subTask() instead.  So Max's code is unusual.

My guess is that Label's implementation on OSX and GTK requires calling back into SWT, whereas it's immediate on Windows.
Comment 4 Brian de Alwis CLA 2014-04-22 12:13:08 EDT
Now that I think about it, I've hit this problem previously too.  It's easy to accumulate the task-name too, so I pushed a fix to:

   https://git.eclipse.org/r/25370
Comment 6 Rob Stryker CLA 2014-04-22 15:27:28 EDT
Awesome work Brian!!
Comment 7 Max Rydahl Andersen CLA 2014-04-22 15:52:33 EDT
Awesome!

Just to explain why we use settaskname:

We did use subtask more in past but:
A) wtp progressmonitors often swallowed it
B) the text gets appended so you can't actually read/see the progress 

so this solution is much much better! Thanks!
Comment 8 Brian de Alwis CLA 2014-04-29 12:56:21 EDT
Verified with broken-progressbar test program against I20140428-2000.
Comment 9 Dani Megert CLA 2014-06-02 07:46:24 EDT
This causes NPEs, see bug 436328.
Comment 10 Dani Megert CLA 2014-06-02 08:50:33 EDT
And another regression: bug 436356.
Comment 11 Brian de Alwis CLA 2014-06-02 09:44:52 EDT
I'll put up a patch in 15 mins
Comment 12 Brian de Alwis CLA 2014-06-02 10:39:47 EDT
Regression tracked in bug 436358