This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 158269 - MainMenuAction initialization blocks AWT for more than 100ms
Summary: MainMenuAction initialization blocks AWT for more than 100ms
Status: RESOLVED INCOMPLETE
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Petr Cyhelsky
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 144426
  Show dependency tree
 
Reported: 2009-02-10 10:26 UTC by Jaroslav Tulach
Modified: 2012-10-29 10:11 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Picture showing the problem (49.86 KB, image/png)
2009-02-10 10:27 UTC, Jaroslav Tulach
Details
Profiler snapshot (40.84 KB, application/octet-stream)
2009-02-10 10:27 UTC, Jaroslav Tulach
Details
Profiler snapshot (40.84 KB, application/octet-stream)
2009-02-10 10:36 UTC, Jaroslav Tulach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2009-02-10 10:26:24 UTC
As part of working on issue 144426, I am trying to eliminate as much code that runs during start in AWT thread as 
possible. There is a test in performance module called AWTThreadFreeTest, which just generated following thread dump. 
It shows that creation of MainMenuAction takes really long. The reason is that it initializes mime lookup and reads 
its various settings. This seems quite useless for an action that is not even visible. Can you delay the 
initialization or run it outside of AWT?
Comment 1 Jaroslav Tulach 2009-02-10 10:27:05 UTC
Created attachment 76778 [details]
Picture showing the problem
Comment 2 Jaroslav Tulach 2009-02-10 10:27:48 UTC
Created attachment 76779 [details]
Profiler snapshot
Comment 3 Jaroslav Tulach 2009-02-10 10:36:46 UTC
Created attachment 76780 [details]
Profiler snapshot
Comment 4 Jaroslav Tulach 2009-02-10 10:38:23 UTC
Indeed, this patch make the problem go away:
--- MainMenuAction.java Base (BASE)
+++ MainMenuAction.java Locally Modified (Based On LOCAL)
@@ -101,9 +101,6 @@
         // needs to listen on Registry - resultChanged event is fired before 
         // TopComponent is really focused - this causes problems in getComponent method 
         Registry.addChangeListener(this);
-        kbs = MimeLookup.getLookup(MimePath.EMPTY).lookupResult(KeyBindingSettings.class);
-        kbs.addLookupListener(this);
-        kbs.allInstances();
         this.forceIcon = forceIcon;
         this.forcedIcon = forcedIcon;
     }
Comment 5 Vitezslav Stejskal 2009-02-12 09:22:21 UTC
"This seems quite useless for an action that is not even visible." - Why do you think that the action is not visible.
MainMenuAction and its subclasses are wrapper actions for showing editor actions in the main menu. The editor actions
are invisible, but MainMenuAction is used for exposing them in the main menu.

"Can you delay the initialization or run it outside of AWT?" - Maybe. I'll have to have a closer look. The code that
your patch removes was added recently in order to fix problems with stale shortcuts shown on editor actions in the main
menu. Basically MainMenuAction has to listen on MimeLookup and pick up shortcut changes done in Tools-Options.
Comment 6 David Strupl 2012-10-25 13:39:14 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 7 David Strupl 2012-10-26 13:20:44 UTC
Petre, Tomasi, is this still a problem? Closing as incomplete. If it is a problem, please reopen.
Comment 8 Miloslav Metelka 2012-10-29 10:11:21 UTC
Btw MainMenuAction will be eliminated once AbstractEditorAction will be made public.