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.
Currently ProfilerModule.restore() initializes the whole profiler infrastructure including various checks, spawning new threads, loading classes, etc. This was OK when profiler was just an add-on plugin, but since it is part of the standard distribution and because it is not used by majority of users (less than 30%, is my guess) and not all the time. It is desirable to defer such initialization till user clearly indicates an interest in the profiler itself.
Created attachment 74387 [details] Raw patch deferring initialization till an action is invoked
Created attachment 74388 [details] Modified JAR to let Alexander and Oleg measure potential gain of this change
Whitelist violators report: 1st and 2nd startup: Removed: org.netbeans.modules.profiler.ProfilerControlPanel2Support Startup with LimeWire project: Removed: org.netbeans.modules.maven.profiler.MavenProjectTypeProfiler org.netbeans.modules.profiler.ProfilerControlPanel2Support http://www.netbeans.org/issues/show_bug.cgi?id=153383: org.netbeans.modules.profiler.AbstractProjectTypeProfiler org.netbeans.modules.profiler.freeform.FreeFormProjectTypeProfiler org.netbeans.modules.profiler.j2ee.J2EEProjectTypeProfiler org.netbeans.modules.profiler.j2se.J2SEProjectTypeProfiler org.netbeans.modules.profiler.nbmodule.NbModuleProjectTypeProfiler org.netbeans.modules.profiler.utils.ProjectUtilities Total: 8 class(es) Total number of loaded classes is less by 52 in 1st and 2nd startup, by 58 in startup with LimeWire project.
Created attachment 74423 [details] Loaded Classes diff for 1st NetBeans startup
Created attachment 74424 [details] Loaded Classes diff for NetBeans startup with LimeWire
Loaded Classes diff for 2nd NetBeans startup doesn't differ from Loaded Classes diff for 1st startup in the number of loaded profiler classes.
Won't fix for 6.7 I have tested the patch but unfortunately the whole profiler infrastructure is initialized as soon as the "Profile" menu is opened: INFO [org.netbeans.lib.profiler.common.Profiler]: profiler is here org.netbeans.modules.profiler.NetBeansProfiler@3015b303 java.lang.Exception: stacktrace at org.netbeans.lib.profiler.common.Profiler.getDefault(Profiler.java:137) at org.netbeans.modules.profiler.actions.ModifyProfilingAction.isEnabled(ModifyProfilingAction.java:70) at org.openide.awt.Actions$MenuBridge.updateState(Actions.java:952) at org.openide.awt.Actions.connect(Actions.java:198) at org.openide.awt.Actions.connect(Actions.java:165) at org.openide.awt.Actions$MenuItem.<init>(Actions.java:1285) at org.netbeans.modules.openide.awt.DefaultAWTBridge.createMenuPresenter(DefaultAWTBridge.java:68) at org.openide.util.actions.CallableSystemAction.getMenuPresenter(CallableSystemAction.java:79) at org.openide.awt.DynaMenuModel.loadSubmenu(DynaMenuModel.java:90) at org.openide.awt.MenuBar$LazyMenu$MenuFolder.createInstance(MenuBar.java:684) at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:857) at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:722) at org.openide.util.Task.run(Task.java:249) at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:70) at org.netbeans.modules.openide.loaders.AWTTask$Processor.run(AWTTask.java:111) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Test to verify profiler starts no threads on start is here: ergonomics#417c64acf417
Integrated into 'main-golden', will be available in build *200906200201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/417c64acf417 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #154324: Allowing profiler to start its test for now. As soon as #154324 is fixed, revert this commit
Profiler is being initialize lazily. The test is updated to reflect the change http://hg.netbeans.org/profiler-main/rev/5ec2cabbc8b3
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/5ec2cabbc8b3 User: Jaroslav Bachorik <yardus@netbeans.org> Log: #154324: Profiler thread is not being started prematurely