Bug 29642 - Performance problems on Mac
Summary: Performance problems on Mac
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P2 normal with 7 votes (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 30695 31560 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-01-16 11:09 EST by Veronika Irvine CLA
Modified: 2004-06-28 13:47 EDT (History)
16 users (show)

See Also:


Attachments
outline clicking on M3 (6.66 KB, text/plain)
2003-01-20 12:11 EST, Adam Kiezun CLA
no flags Details
same on 20030115 (3.90 KB, text/plain)
2003-01-20 12:12 EST, Adam Kiezun CLA
no flags Details
outline clicking on 20030115 (expanded a bit) (8.23 KB, text/plain)
2003-01-20 12:17 EST, Adam Kiezun CLA
no flags Details
outline clicking on M3 (expanded to the same level) (7.34 KB, text/plain)
2003-01-20 12:19 EST, Adam Kiezun CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2003-01-16 11:09:54 EST
Install Eclipse 2.1 M4 on the mac.
Open a java editor on a java class with multiple methods.
Go to the default Java Perspective.
Click on a method in the Outline view.
Click on a second method in the Outline view.
There is a noticeable delay when updating the editor to show the selected 
method.

Install Eclipse 2.1 M3 on the mac.
Replace the org.eclipse.swt.carbon plugin with the M4 version of 
org.eclipse.swt.carbon.

Repeat the steps above.
The time to update the editor is noticeably faster.

I do not have numbers to put to the time differences, just observation.
Comment 1 Dirk Baeumer CLA 2003-01-20 07:49:08 EST
Adam, can you please measure M4 and compare the results against M3.
Comment 2 Steve Northover CLA 2003-01-20 11:05:14 EST
We have already tried this, hacking way down deep in the SWT tree widget by 
printing the time taken servicing the SWT.Selection event.  The times that were 
printed out did not seem to reflect the wait.  It's quite possible that I got 
something wrong doing this.

Does the JDT code run in the UI thread?  Does it run in sync/async execs?  Does 
it run in another thread?

Adam, you should answer these questions and try and recreate my hacking so that 
we have some hard numbers.  If you have any other suggestions, I'm open.  
Thanks.
Comment 3 Adam Kiezun CLA 2003-01-20 11:35:24 EST
will have a look
Comment 4 Adam Kiezun CLA 2003-01-20 12:09:36 EST
yup, it does appear to be slower (when you use arrow key to navigate)
looks like StyledText.performPaint is now either 2 times slower than on 
M3 or it's called twice as often
will attach 2 profiles
Comment 5 Adam Kiezun CLA 2003-01-20 12:11:33 EST
Created attachment 3041 [details]
outline clicking on M3 

(test case is going thru all methods in junit Assert class)
Comment 6 Adam Kiezun CLA 2003-01-20 12:12:32 EST
Created attachment 3042 [details]
same on 20030115

same test case
Comment 7 Adam Kiezun CLA 2003-01-20 12:17:31 EST
Created attachment 3043 [details]
outline clicking on 20030115 (expanded a bit)

maybe it's GC.drawString, actually
Comment 8 Adam Kiezun CLA 2003-01-20 12:19:16 EST
Created attachment 3044 [details]
outline clicking on M3 (expanded to the same level)

GC.drawString takes now twice as much as time on M3
Comment 9 Adam Kiezun CLA 2003-01-20 12:22:47 EST
back to SWT - looks like it's not jdt (jdt's stuff takes now 7% compared to 
StyledText 40%)

please bounce back if you think otherwise
Comment 10 Veronika Irvine CLA 2003-01-20 12:56:41 EST
We know that with Core Graphics versus QuickDraw there is a 2x slow down.

However, there is more slowness than that.  If you use the exact same version 
of the SWT jar (which includes StyledText) then you can still see a slow down 
between M3 and M4 when clicking between methods (see original description of 
the problem).  That is what this PR is meant to focus on.

Sending back to JDT UI.
Comment 11 Steve Northover CLA 2003-01-20 13:09:01 EST
Guys, stop the bounce and get to the bottom of it.  We know that string draw is 
slower in Core Graphics vs Quickdraw.  If string draw is actually the cause of 
the slow down, then there are two things we can do.  Optimize string draw in 
SWT (has already been done once by SSQ but there may be more we can do) or make 
sure that JDT or StyledText or whoever is not calling string draw too many 
times.

Before investing time into this, I would comment out string draw (and string 
measure?) making this operation take zero time and then compare the results.
Comment 12 Adam Kiezun CLA 2003-01-20 13:12:48 EST
note also that i do not any slowdown when clicking between methods using the 
mouse, only keyboard 
Comment 13 Adam Kiezun CLA 2003-01-20 13:17:12 EST
Veronika, what do you mean by 'clicking'? Is it with the keyboard or mouse.
We asked Kai and the little delay when using the cursor keys is on purpose 
(to avoid redrawing when the arrow key is held down). So, if that's what you 
mean, then we can close as 'worksforme'
Comment 14 Veronika Irvine CLA 2003-01-20 14:19:59 EST
I mean clicking with the mouse.
Comment 15 Adam Kiezun CLA 2003-01-21 04:00:23 EST
i see no speed difference on windows
maybe it's mac X specific
asking Andre

Andre, can you please have a look and comment if you perceive any difference in 
the described scenario?
Comment 16 Veronika Irvine CLA 2003-01-21 08:39:10 EST
Perhaps Windows is not a good reference platform because it is quite fast 
(graphics calls are much faster than on any other platform) and small 
differences will not be noticeable.

How about motif on linux or GTK on linux?
Comment 17 Steve Northover CLA 2003-01-21 09:34:57 EST
Adam, look at the OS field.  The slow down is on MacOS X.  If you have been 
testing elsewhere, you have been wasting time.  Please redo your tests on MacOS 
X.  Thanks.
Comment 18 Adam Kiezun CLA 2003-01-21 09:42:16 EST
Steve, i do not have access to Mac os X here
only Andre does
Comment 19 Adam Kiezun CLA 2003-01-21 09:44:39 EST
nothing i can do here
back to inbox
Comment 20 Steve Northover CLA 2003-01-21 10:32:07 EST
Veronika, what do you want to do?  It's critical that we address this.
Comment 21 Dirk Baeumer CLA 2003-01-21 12:24:28 EST
Steve, since the SWT team has most experience with Mac OS (and the necessary 
hardware) it would be nice if you could provide the necessary performance 
tests. We can only ensure that JDT UI didn't slow down in general, what we did 
by testing the performance on Windows. If there are special issue with Mac OS 
they might be useful for other plug-ins as well.
Comment 22 Steve Northover CLA 2003-01-21 15:05:49 EST
Ok, can you comment on my questions/observations from before:

"We have already tried this, hacking way down deep in the SWT tree widget by 
printing the time taken servicing the SWT.Selection event.  The times that were 
printed out did not seem to reflect the wait.  It's quite possible that I got 
something wrong doing this.

Does the JDT code run in the UI thread?  Does it run in sync/async execs?  Does 
it run in another thread?"
Comment 23 Steve Northover CLA 2003-01-21 15:06:37 EST
Basically, I hacked way down deep to get some timings and they didn't reflect 
what I was seeing and feeling in the UI.
Comment 24 Dirk Baeumer CLA 2003-01-22 04:33:02 EST
The Outliner uses post selection change listeners, which are provided by the 
JFace. The have some sort of delay when selecting with the cursor keys.

Carboning Daniel and Kai-Uwe about the question if some of the code triggered 
by selection changes in the outliner are processed asynchronously. The know 
most about that code.

Comment 25 Christophe Cornu CLA 2003-01-23 10:28:14 EST
Moving to Platform SWT.

Some benchmarking comparison

M3 2 to 4 times faster than I20030121
M3 comparable to I20030121 with fake GC.stringExtent, fake GC.drawString
M3 with fake GC.stringExtent/drawString still 2 times faster than I20030121 with 
fake GC too

Details
- eMac PowerPC G4 800Mhz OS X 10.2
- Instrumented JavaEditor.setSelection (org.eclipse.jdt.ui plugin)
- Self Host
- Maximize Eclipse
- Same runtime workspace with same file ImageData - switch to first constructor, 
then 2nd etc until 4th in method outline view

Each line: (average result per method) [time to switch to first method] [time to 
switch to second method] [time to 3rd] [time to 4th] in milliseconds

M3
(152) 295 69 139 103
(103) 100 70 134 107

I20030121
(386) 185 538 420 400
(322) 176 372 395 344

M3, SWT I20030121
(375) 247 444 418 388
(375) 168 547 405 381

*1 fake GC.drawString
*2 fake GC.stringExtent

I20030121 *1 *2
(122) 110 124 117 138

I20030121 *2
(251) 139 298 309 258

M3 *1 *2
(66) 81 62 60 61
Comment 26 Andre Weinand CLA 2003-01-30 16:00:45 EST
Did you try "Quartz Debug"?
Comment 27 Steve Northover CLA 2003-01-31 11:50:18 EST
*** Bug 30695 has been marked as a duplicate of this bug. ***
Comment 28 Christophe Cornu CLA 2003-01-31 11:55:27 EST
Moving to Silenio
Comment 29 Veronika Irvine CLA 2003-02-04 10:09:34 EST
Clicking case has been improved.  There are still other areas.
Comment 30 Steve Northover CLA 2003-02-11 13:49:31 EST
*** Bug 31560 has been marked as a duplicate of this bug. ***
Comment 31 Andre Weinand CLA 2003-02-11 16:37:19 EST
In my previous implementation of SWT I could improve typing performance of Eclipse by 
removing the (under Quartz totally uneccessary) double buffering in StyledText.
Today I tried that again but I wasn't able to get identical drawing (and scrolling) behavior 
after uncommenting double buffering.
Any low-hanging fruit in that area?
Comment 32 Steve Northover CLA 2003-02-11 18:08:55 EST
We already hacked that and it makes no difference.
Comment 33 Steve Northover CLA 2003-02-14 15:12:54 EST
We have made some improvements in the latest.  The current theory is that 
mixing Core Graphics and Quickdraw calls makes things slow.  We have 
absolutely no proof of this at all and unfortunately, the only way to really 
prove it is to put back Quickdraw which is lots of work.

Unfortunately, Mac performance work is getting in the way of finishing off the 
native table and tree.  The tree is very close.

Can you get the latest and retry?  We need to decide whether the current 
performance is good enough for now.  We would continue the work, but after 2.1.

Your thoughts?
Comment 34 Andre Weinand CLA 2003-02-17 08:12:17 EST
Current typing performance on my PowerBook 800 is quite acceptable.
I'm doing 98% of all my development there and I do *not* consider it "a pain".

However, the real show stoppers right now are:

- jumping characters and rounding errors which result in off-by one caret position errors 
(#28514)

- Trees are not compact enough or cannot be made compact enough partially because of 
#28739; so when trying to get the native tree ready, please make sure that it doesn't not 
waste even more space than the existing tree, and if it does, provide a way to let users 
switch back to the emulated tree).

Comment 35 Silenio Quarti CLA 2003-02-19 15:06:05 EST
Check also comments in bug#30768.
Comment 36 Steve Northover CLA 2003-03-25 11:50:05 EST
Downgrading this to P2.  Performance is now acceptable.  We'll work more on 
this after 2.1 ships.
Comment 37 Scott Ellsworth CLA 2003-04-14 13:48:15 EDT
Is it appropriate to put the overlong delay when cmd-space-ing after a variable. here?  If not, let 
me know and I will create a new bug report.

Release 2.1 is slower than I would like when performing a command-space on my TiBook 667/1G/
48G.  It can take two seconds for the context menu to appear in a case like:

String foo = new String();
String bar = foo.<cmd-space here>

Similarly,

RS_<cmd-space> brings up a pick list of 95 possible classes.  This takes about two seconds.

RS_Evidence e=new RS_Evidence():
e.<cmd-space> also takes about two seconds.  That class has 121 methods.  It takes about a 
second and change to do the same on a class in the same package (RS_Phone_Number) that has 
only twelve methods.

So, it does not appear to be linear in the number of classes or methods, at least for under a 
hundred or so choices.

I have not made any changes to eclipse or its startup parameters since installing it, though I do 
have a number of projects in my workspace that have moved forward from 2.0.1, M3-M5, and the 
RCs.  Since there are fifty of them, I would rather not delete and recreate them unless there is 
reason to believe it will help.
Comment 38 Silenio Quarti CLA 2003-04-16 11:31:31 EDT
There is a separate bug for this Bug#33492.
Comment 39 Scott Ellsworth CLA 2003-04-21 17:52:13 EDT
33492 is actually not appropriate for delays in cmd-space, as 33492 affects only error messages.  
Based on this, though, I believe the slow appearance of the popup is not related to the outline 
clicking, and will thus open a new bug.

Thank you for your time.
Comment 40 Silenio Quarti CLA 2003-04-22 18:38:58 EDT
We improved menu item creation performance (setting text, accel, etc) by removing
calls to GetIndMenuItemWithCommandID() (which is really slow). Clicking between 
views is much faster now (specially between the outline view and the editor).

Comment 41 Steve Northover CLA 2003-05-21 10:35:49 EDT
We have made lots of performance improvements for 2.1.1.  Please get this or a 
nightly and let us know what you think.  There are always more things we can 
do.  Are there any particular areas that we should look at again.  Thanks.
Comment 42 Scott Ellsworth CLA 2003-05-21 17:15:02 EDT
It has definitely gotten better since 2.1 - I tested with 20030520.  The outline view is rather 
sprightly.  I can still outpace it with a flurry of mouse clicks, but it is definitely more usable now.  
Good job!

I made a few more tests in support of 36732 (cmd-space popup too slow to appear), as that is still 
draggier than I would like, but the progress on 29642 was very heartening.  I am very encouraged.

Scott
Comment 43 Ringo De Smet CLA 2003-05-24 02:27:22 EDT
I can second Scott's comments. Build 20030520 is definitely going in the good direction! Keep up 
the good work.

Ringo
Comment 44 Silenio Quarti CLA 2004-06-28 13:47:58 EDT
Performance of the Mac port in general was addressed in R3.0. Please open specific bug reports if you 
still have cases were performance is not acceptable.