Bug 87493 - PackageExplorerPart#makeActions des a lot of work on startup [package explorer]
Summary: PackageExplorerPart#makeActions des a lot of work on startup [package explorer]
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Tobias Widmer CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-03-09 08:47 EST by Tod Creasey CLA
Modified: 2005-04-19 04:34 EDT (History)
2 users (show)

See Also:


Attachments
Trace of opening the Java Perspective (121.22 KB, text/plain)
2005-03-15 16:00 EST, Tod Creasey CLA
no flags Details
Trace with content type corrected (121.22 KB, text/html)
2005-03-15 16:00 EST, Tod Creasey CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2005-03-09 08:47:12 EST
M5a

When I restarted a workbench containing the following (collapsed) projects
loaded from HEAD:

org.eclipse.core.commands
org.eclipse.jface
org.eclipse.ui
org.eclipse.ui.ide
org.eclipse.ui.views
org.eclipse.ui.workbench

The method PackageExplorerPart#makeActions took 9.85% of my startup time (1881ms
in this case). About half of that was in the Refactor actions
Comment 1 Dirk Baeumer CLA 2005-03-09 08:57:12 EST
We are aware of this. However the problem is an architectural problem in
Platform/UI which I discussed with Nick at EclipseCon. Since we have global menu
entries for all our actions we have to retarget them and initialize the right
enablement state. Otherwise short cuts will not work correctly or the enablement
state will not be correct if the global menu pops down.

We will look into improving this however there are no low hanging fruits ;-)
Comment 2 Dirk Baeumer CLA 2005-03-14 10:00:56 EST
Tobias, as discussed we should avoid that the refactoring actions load the
refactorings/processor to determine their enablement state. 

Can you please add the improvement this will give to this PR. We can then decide
if it is worth doing anything else.
Comment 3 Tobias Widmer CLA 2005-03-15 05:14:06 EST
Profiling shows that a lot of time is spent to load the refactoring classes 
for availability checking. Additionally, the empty IStructuredSelection on 
startup could be handled more efficiently.
Extracted availability checking of all refactorings to a single class, 
implemented early pruning on the selections to avoid java model access.
The performance gain is significant: On average, the refactor action group 
needs 500ms less time to initialize itself.
Avoiding eager class-loading seems to be an easy way to shorten the startup 
time in this case.
Comment 4 Tod Creasey CLA 2005-03-15 15:59:41 EST
My profile of opening the JavaPerspective showed the following (I had already
touched the plug-in by selecting the preference page while in the resource
perspective).

Of the 3.456 seconds it took to open the Java Perspective 1.767 (51%) of them
were taken in  the PackageExplorerActionGroup constructor. Refactor was about a
quarter of this time.

I will attack the profilers trace
Comment 5 Tod Creasey CLA 2005-03-15 16:00:11 EST
Created attachment 18807 [details]
Trace of opening the Java Perspective
Comment 6 Tod Creasey CLA 2005-03-15 16:00:43 EST
Created attachment 18808 [details]
Trace with content type corrected
Comment 7 Dirk Baeumer CLA 2005-04-06 06:04:55 EDT
Tobias, as discussed we should create a trace to further understand what classes
are loaded during package explorer startup. May be there are some additional low
hanging fruits.
Comment 8 Tobias Widmer CLA 2005-04-15 04:47:41 EDT
Avoided bundle loading of LTK Core/UI
Implemented cut to avoid eager class loading during byte code verification

Fixed > 20050414
Comment 9 Tod Creasey CLA 2005-04-18 15:20:13 EDT
What sort of performance gain does this give us?
Comment 10 Tobias Widmer CLA 2005-04-19 04:34:33 EDT
On my machine P4 3Ghz 768 MB I measured the following for the package explorer 
open test, on clean installations and fresh workspaces:

3.0.2: 1.75s CPU Time
I20050413-0910: 900ms CPU Time

I am not sure why these numbers are not reflected in the performance tests 
(this has perhaps something to do with the downgrading of the windows test 
machines?)