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.
When open folder with 1001 subfolders the method ChildrenArray.nodes() takes about 30% of CPU time of folder_recognize thread. Stack from optimizeit: 32.84% - org.openide.nodes.ChildrenArray.nodes() 30.4% - org.openide.nodes.Node.addNodeListener() 29.92% - org.openide.nodes.Node$LookupEventList.init() 28.66% - FilterNode$FilterLookup$ProxyResult.allItems()
Improvement this method will also speed up open folder (see issue 30014).
Written test that simulates the incorrect behaviour.
Fixed, but needs review. Check the attached patch.
Created attachment 8803 [details] Changes the way how Node points to ChildrenArray it is contained in
Created attachment 8804 [details] The correct patch is here, sorry.
Created attachment 8815 [details] Necessary change in Looks tests
The main point behind speeding up the addNodeListener is to delay the initialization of the bridge between getCookie and Lookup. As NodeListener can be used for a lot of things (icon, displayname, etc.) and is often attached as soon as possible, I have decided to not initialize the bridge at a time the listener is attached, but after first call to getCookie or getLookup. As this bridge was not yet part of any release I think it is fine to change its behaviour. Because of the change I had to add one line (node.getCookie) into one of the looks tests.
Ok Hrebejku I am going to apply the changes.
Checking in src/org/openide/nodes/ChildrenArray.java; /cvs/openide/src/org/openide/nodes/ChildrenArray.java,v <-- ChildrenArray.java new revision: 1.9; previous revision: 1.8 done Checking in src/org/openide/nodes/FilterNode.java; /cvs/openide/src/org/openide/nodes/FilterNode.java,v <-- FilterNode.java new revision: 1.74; previous revision: 1.73 done Checking in src/org/openide/nodes/Node.java; /cvs/openide/src/org/openide/nodes/Node.java,v <-- Node.java new revision: 1.66; previous revision: 1.65 done Processing log script arguments... More commits to come... Checking in test/unit/src/org/openide/nodes/NodeLookupTest.java; /cvs/openide/test/unit/src/org/openide/nodes/NodeLookupTest.java,v <-- NodeLookupTest.java new revision: 1.10; previous revision: 1.9 done
verified