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 169510

Summary: Schema model optimization by avoiding array copying
Product: xml Reporter: Nikita Krjukov <supernikita>
Component: XAMAssignee: Nikita Krjukov <supernikita>
Status: VERIFIED FIXED    
Severity: blocker CC: apireviews, slunegov, sustaining, yaroslavskiy
Priority: P2 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: The diff with the main changes is going to be applied
The corrected diff. I mainly improved javadoc comments and made the version change smaller

Description Nikita Krjukov 2009-07-29 23:22:41 UTC
Two new abstract methods is necessary to be added to 
xml.xam/src/org/netbeans/modules/xml/xam/AbstractComponent.java 
for the sake of performance enhancement

public void checkChildrenPopulated();
public void getChildrenCount();

Method getChildren() makes copy of children's list and it can be time consuming in case of big amount of children. 
The method is called very frequently in order to be sure that children are populated. But the output of the method 
isn't used at all. Another case is request of the children's count. In both cases it doesn't make sense to make
children's copy. So it's suggested to introduce two new methods. 

The AbstractComponent is an abstract implementation of the Component interface. I put the methods to the class but not
to the interface at first because the performance experiments proofed that it is sufficient. And also it should reduce
impact to backward compatibility. Though I'm quite sure AbstractComponent class is the only direct implementation of
Component interface.
Comment 1 Nikita Krjukov 2009-07-29 23:51:08 UTC
Created attachment 85498 [details]
The diff with the main changes is going to be applied
Comment 2 Jesse Glick 2009-08-03 15:28:30 UTC
The diff shows the new methods concrete, not abstract. (Which is good.)
Comment 3 Nikita Krjukov 2009-08-03 19:14:32 UTC
Created attachment 85721 [details]
The corrected diff. I mainly improved javadoc comments and made the version change smaller
Comment 4 Nikita Krjukov 2009-08-05 13:49:13 UTC
Adding new methods doesn't prevent using old style approach - getChildren() or getChildren().size() 
So the it doesn't affect any code, which remains unchanged. 
Comment 5 Nikita Krjukov 2009-08-05 17:27:43 UTC
Fixed in trunk http://hg.netbeans.org/main/rev/13a148091090
Comment 6 Nikita Krjukov 2009-08-05 18:22:35 UTC
Fixed
Comment 7 Nikita Krjukov 2009-08-05 19:07:54 UTC
Verified with JUnit tests + verifying different BPEL projects
Comment 8 Quality Engineering 2009-08-06 06:00:33 UTC
Integrated into 'main-golden', will be available in build *200908060201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/13a148091090
User: supernikita@netbeans.org
Log: #169510 - Schema model optimization by avoiding array copying
Comment 9 pgebauer 2009-10-06 11:58:25 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/542505351438
http://hg.netbeans.org/release67_fixes/rev/3f5c7203b728
Comment 10 Sergey Lunegov 2009-10-12 15:20:34 UTC
Verified by Michael Nazarov.