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.
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?
Created attachment 76778 [details] Picture showing the problem
Created attachment 76779 [details] Profiler snapshot
Created attachment 76780 [details] Profiler snapshot
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; }
"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.
Bug prior to 7.0, not touched for the last 2 years --> P4.
Petre, Tomasi, is this still a problem? Closing as incomplete. If it is a problem, please reopen.
Btw MainMenuAction will be eliminated once AbstractEditorAction will be made public.