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 75588

Summary: Performance: IDE consumes 100% CPU and causes OutOfMemoryError
Product: xml Reporter: Samaresh Panda <samaresh>
Component: CodeAssignee: Marek Fukala <mfukala>
Status: VERIFIED FIXED    
Severity: blocker CC: issues, mgrebac, susanh
Priority: P2 Keywords: PERFORMANCE
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Snapshot from profiler
OTA schema file

Description Samaresh Panda 2006-04-26 23:44:34 UTC
Originally, this bug was filed on Netbeans Enterprise Pack build. See
http://bt2ws.central.sun.com/CrPrint?id=6417777.

We ran the profiler and found few hotspots:
1. DocumentModel.updateModel()
2. DocumentModel.DocumentModelModificationTransaction.removeDE()
Both these classes are in package org.netbeans.modules.editor.structure.api.
Please find the snapshot from profiler.

I tried to simulate the same from NB5.5 build and it turns out IDE consumes 100%
CPU in multiple situations.
1. Open OTA_TravelItinerary schema and restart IDE.
2. Open OTA_TravelItinerary schema, make some changes like replaceALL on some
xsd:attributeGroup.

For your convenience, I have attached the schema.
Comment 1 Samaresh Panda 2006-04-26 23:45:52 UTC
Created attachment 30075 [details]
Snapshot from profiler
Comment 2 Samaresh Panda 2006-04-26 23:46:45 UTC
Created attachment 30076 [details]
OTA schema file
Comment 3 Petr Jiricka 2006-04-27 08:39:39 UTC
Assigning to Marek. Marku, could this be related to issue 74506 that you were
fixing recently?
Comment 4 Marek Fukala 2006-04-27 10:26:12 UTC
As for the case #1 (open the xml document) - the document model + navigator UI
initialization time is ~2000ms, regardless whether opened in editor and
restarted or just opened. In the first case the time is longer since there is a
lot of things being initialized during startup.

As for the second case it is worser. Many document content updates in certain
places causes the document model to handle each of them separately which takes
quite long time for such big document and for such big amount of modifications.
I will try to improve it, or, if it won't be feasible, I'll do a hack like that
if there is so many modifications at once, I'll throw the current model and
rescan the whole document again.
Comment 5 Marek Fukala 2006-04-27 14:45:26 UTC
I am afraid it is not possible to fix the problem without doing some extensive
changes. I will fix the problem by reimplementing part of the xml model code
responsible for xml document changes identification, but not to release 5.5
beta. We agreed with Petr Jiricka and Petr Blaha that the issue will be fixed
after and also on downgrading it to P2 (the problem is serious, but occures just
under some non-trivial circumstances).
Comment 6 Marek Fukala 2006-06-01 15:28:18 UTC
*** Issue 76208 has been marked as a duplicate of this issue. ***
Comment 7 Marek Fukala 2006-06-01 15:28:33 UTC
I am duplicating the Issue #76208 to this issue since both of them are mostly
about the same (previously described) problem. I am going to reimplement part of
the DocumentModel code and the XMLDocumentModel navigator implementation to 5.5
so both issue should be fixed.
Comment 8 Marek Fukala 2006-07-20 17:10:37 UTC
Hopefully fixed - the performance on the big file is now much more better.
Please verify asap...

Checking in tageditorsupport/src/org/netbeans/modules/editor/structure/api/Docum
entModel.java;
/cvs/xml/tageditorsupport/src/org/netbeans/modules/editor/structure/api/Document
Model.java,v  <--  DocumentModel.java
new revision: 1.7.2.2.2.4; previous revision: 1.7.2.2.2.3
done
Checking in text-edit/src/org/netbeans/modules/xml/text/navigator/TreeNodeAdapte
r.java;
/cvs/xml/text-edit/src/org/netbeans/modules/xml/text/navigator/TreeNodeAdapter.j
ava,v  <--  TreeNodeAdapter.java
new revision: 1.2.2.2.2.5; previous revision: 1.2.2.2.2.4
done
Comment 9 Jindrich Sedek 2006-08-22 15:05:55 UTC
Verified NetBeans 5.5Dev 200608220000
Comment 10 tamiro 2006-09-20 20:05:15 UTC
*** Issue 85245 has been marked as a duplicate of this issue. ***