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 50686 - [perf] Excessive parsing of Java files during startup
Summary: [perf] Excessive parsing of Java files during startup
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC All
: P3 blocker (vote)
Assignee: Martin Matula
URL:
Keywords: PERFORMANCE
: 50536 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-21 10:23 UTC by _ rkubacki
Modified: 2007-09-26 09:14 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
log file (54.94 KB, text/plain)
2004-10-21 10:24 UTC, _ rkubacki
Details
Diff to be applied in nb_all/editor (1.27 KB, patch)
2004-10-22 14:51 UTC, Martin Matula
Details | Diff
Diff to be applied in nb_all/java (1.05 KB, patch)
2004-10-22 14:52 UTC, Martin Matula
Details | Diff
Diff to be applied in nb_all/java (3.15 KB, patch)
2005-01-21 13:29 UTC, Martin Matula
Details | Diff
Diff to be applied in nb_all/objectbrowser (2.57 KB, patch)
2005-01-21 13:32 UTC, Martin Matula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2004-10-21 10:23:14 UTC
dev build from 2004, Oct 20, JDK1.5.0

When starting the IDE with existing project setup
and some file opened in editor there are three
calls to parse the content of file. The first pair
is probably result of some bad logic in
ResourceImpl and these are triggered by fold
manager from editor. The third one follows after
classpath initialization.

Also there are two requests to parse all files in
inheritance tree (at least some of them related to
override annotations processing).

And there is yet another request for parsing of
java.lang.String. This can be related to searching
of main classes.
Comment 1 _ rkubacki 2004-10-21 10:24:24 UTC
Created attachment 18424 [details]
log file
Comment 2 _ rkubacki 2004-10-21 10:25:47 UTC
I attached log file with some thread dumps showing stacks of calls to
ASTProvider and possible place in fold manager that asks for parsing.
Comment 3 Martin Matula 2004-10-21 12:15:31 UTC
I am going to fix the "bad logic" that causes the initial parse to be
repeated as mentioned by Radim.
Comment 4 Martin Matula 2004-10-21 13:00:26 UTC
I've fixed the bad logic. It could have caused several other parses
than the redundant parse of Main class. Radime, please measure the
results and provide us with an updated log. Thanks!
Comment 5 Martin Matula 2004-10-22 14:50:36 UTC
I am attaching very simple diffs for java and editor modules which
eliminate parsing at startup, before the classpath scan is finished.
This takes the number of parses for a single file after startup to
one. Performance folks, please evaluate and decide whether these
should be integrated.
Comment 6 Martin Matula 2004-10-22 14:51:50 UTC
Created attachment 18449 [details]
Diff to be applied in nb_all/editor
Comment 7 Martin Matula 2004-10-22 14:52:44 UTC
Created attachment 18450 [details]
Diff to be applied in nb_all/java
Comment 8 Jan Pokorsky 2004-10-22 23:31:11 UTC
Martine, should not the same be applied to the override anotation
support too?
Comment 9 Martin Matula 2004-10-25 09:45:39 UTC
Maybe it should. What I did was I added a thread dump to the parser so
that I could detect what triggers the parsing during the startup. The
two places in the code that I added the waitScanFinished call into
were the only two I saw. After I added waitScanFinished to these two
places, I didn't see any parsing during the startup anymore. But it
could be a race condition.
Comment 10 _ rkubacki 2004-10-27 12:47:04 UTC
*** Issue 50536 has been marked as a duplicate of this issue. ***
Comment 11 _ rkubacki 2004-10-27 16:18:34 UTC
The percieved performance with the patch is a bit different. Classpath
scanning dialog is shown quickly after main window is displayed and
when it is completed the fold and navigation view is update (this can
last couple of seconds if a large file is opened). 

The time to start the IDE with java.awt.Component + 5 other files
opened till no UI activity on my Linux 2GHz, 1GB, JDK 1.5.0.
With the patch: 29.5, 30.3, 29.4, 32
W/o: 34.4, 26.0, 34.7, 26.0, 33.9

So the patch improves bad cases but there are some cases when we are
faster even with current approach. I do not know why.

It seems the may defer this integration for 4.0 and use it in 4.1 and
maybe do somefurther tuning.
Comment 12 Martin Matula 2004-10-27 16:29:01 UTC
OK, after agreement with Radim, we are going to defer this to 4.1 and
keep it as a P3 issue.
Comment 13 Jan Becicka 2005-01-20 16:03:58 UTC
So - should we apply this patch to trunk?
Comment 14 _ rkubacki 2005-01-21 10:03:55 UTC
Personally I think we should but we probably need to check and measure
it again before applying. Is it uptodate?
Comment 15 Martin Matula 2005-01-21 13:28:58 UTC
I will attach recent updated diffs - Honzo & Dafe please review.
Comment 16 Martin Matula 2005-01-21 13:29:48 UTC
Created attachment 19860 [details]
Diff to be applied in nb_all/java
Comment 17 Martin Matula 2005-01-21 13:32:44 UTC
Created attachment 19861 [details]
Diff to be applied in nb_all/objectbrowser
Comment 18 David Simonek 2005-01-21 14:25:37 UTC
Yo, reviewed and thanks. I guess part to be applied to
objectbrowser/navigator has the effect that navigator content will be
filled *after* class scanning is complete, right? I always wanted to
do this, but didn't know how ;-)
Comment 19 Martin Matula 2005-01-21 14:28:24 UTC
Yes, Dave. And the diff to navigator also fixes one bug which should
be fixed even if we do not apply these diffs - please make sure you
start the transaction out of the try-finally block, not inside it.
This is because if beginTrans fails, no transaction is open, so it
would be a mistake to call endTrans in finally.
Comment 20 Jan Pokorsky 2005-01-24 12:55:46 UTC
The java module patch looks fine.
Comment 21 Martin Matula 2005-01-31 16:12:40 UTC
Fixed.

Checking in
editor/src/org/netbeans/modules/editor/java/NbJavaFoldManager.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/NbJavaFoldManager.java,v
 <--  NbJavaFoldManager.java
new revision: 1.4; previous revision: 1.3
done
Processing log script arguments...
More commits to come...
Checking in src/org/netbeans/modules/java/JavaEditor.java;
/cvs/java/src/org/netbeans/modules/java/JavaEditor.java,v  <-- 
JavaEditor.java
new revision: 1.185; previous revision: 1.184
done
Processing log script arguments...
More commits to come...
Checking in
src/org/netbeans/modules/java/ui/nodes/elements/ChildrenProvider.java;
/cvs/java/src/org/netbeans/modules/java/ui/nodes/elements/ChildrenProvider.java,v
 <--  ChildrenProvider.java
new revision: 1.7; previous revision: 1.6
done
Checking in
navigator/javanavigation/src/org/netbeans/modules/javanavigation/ClassMemberModel.java;
/cvs/objectbrowser/navigator/javanavigation/src/org/netbeans/modules/javanavigation/ClassMemberModel.java,v
 <--  ClassMemberModel.java
new revision: 1.25; previous revision: 1.24
done
Checking in
navigator/javanavigation/src/org/netbeans/modules/javanavigation/InheritanceTreeModel.java;
/cvs/objectbrowser/navigator/javanavigation/src/org/netbeans/modules/javanavigation/InheritanceTreeModel.java,v
 <--  InheritanceTreeModel.java
new revision: 1.9; previous revision: 1.8
done
Comment 22 Quality Engineering 2007-09-20 11:57:31 UTC
Reorganization of java component