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 30657 - ChildrenArray.nodes initializes expansive lookup
Summary: ChildrenArray.nodes initializes expansive lookup
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 30014
  Show dependency tree
 
Reported: 2003-02-04 15:38 UTC by Jiri Rechtacek
Modified: 2008-12-22 19:37 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Changes the way how Node points to ChildrenArray it is contained in (22.39 KB, patch)
2003-02-05 08:47 UTC, Jaroslav Tulach
Details | Diff
The correct patch is here, sorry. (17.76 KB, patch)
2003-02-05 08:50 UTC, Jaroslav Tulach
Details | Diff
Necessary change in Looks tests (793 bytes, patch)
2003-02-05 17:56 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Rechtacek 2003-02-04 15:38:00 UTC
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()
Comment 1 Jiri Rechtacek 2003-02-04 15:40:02 UTC
Improvement this method will also speed up open folder (see issue 30014).
Comment 2 Jaroslav Tulach 2003-02-04 18:21:55 UTC
Written test that simulates the incorrect behaviour.
Comment 3 Jaroslav Tulach 2003-02-05 08:47:00 UTC
Fixed, but needs review. Check the attached patch.
Comment 4 Jaroslav Tulach 2003-02-05 08:47:53 UTC
Created attachment 8803 [details]
Changes the way how Node points to ChildrenArray it is contained in
Comment 5 Jaroslav Tulach 2003-02-05 08:50:36 UTC
Created attachment 8804 [details]
The correct patch is here, sorry.
Comment 6 Jaroslav Tulach 2003-02-05 17:56:34 UTC
Created attachment 8815 [details]
Necessary change in Looks tests
Comment 7 Jaroslav Tulach 2003-02-05 18:00:25 UTC
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.
Comment 8 Jaroslav Tulach 2003-02-07 18:04:41 UTC
Ok Hrebejku I am going to apply the changes.
Comment 9 Jaroslav Tulach 2003-02-07 18:23:20 UTC
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
Comment 10 Marian Mirilovic 2004-03-14 12:11:47 UTC
verified