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 32171 - Slow one-file recompilation
Summary: Slow one-file recompilation
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@java
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 32065 34165
  Show dependency tree
 
Reported: 2003-03-20 17:29 UTC by Petr Nejedly
Modified: 2007-09-26 09:14 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed patch (2.18 KB, patch)
2003-03-27 13:40 UTC, Svata Dedic
Details | Diff
Binary patch for testing (8.57 KB, application/octet-stream)
2003-03-27 14:52 UTC, Svata Dedic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Nejedly 2003-03-20 17:29:13 UTC
See issue 32065 for details.
Most of the time on the one-file recompilation
is spent in the (all-covering?) refresh.
Is it possible to optimize it somehow?
Branch cutting or the likes?
Comment 1 Svata Dedic 2003-03-21 06:49:27 UTC
As a background - we had a number of bugs related to JavaDataObject
not knowing its .class files or reporting it is out of date (when it
was compiled, actually). We did a minimal refresh in NB-3.3, and the
"global" refresh catched the corner cases, like files reached and
compiled through closure etc.

The refresh is not all-covering, actually, or should not be. It
refreshes a folder, and its children folders, which existed before
(not the new ones which appeared). I have no other clue about how to
prune the tree of potentially changed objects, sorry -- but maybe I
overlooked some trick, please advise.
Comment 2 Svata Dedic 2003-03-21 15:23:06 UTC
IMHO not possible to prune refreshing too much further for 3.5.
Comment 3 Petr Nejedly 2003-03-26 10:52:20 UTC
But it could at least skip refreshing the whole SystemFS, couldn't it?
I've added a log to MFO.refresh and got answer "42" ;-)
All the SFS folders were refreshed, like:

MFO.refresh(DTDs/4_0)
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1071)
at o.o.fs.MultiFileObject.refresh(MultiFileObject.java:371)
at o.o.fs.AbstractFolder.refresh(AbstractFolder.java:389)
at o.o.fs.MultiFileObject.refresh(MultiFileObject.java:1178)
at o.o.fs.FileObject.refresh(FileObject.java:662)
at o.n.m.java.JExtCG.refresh(JExternalCompilerGroup.java:560)
at o.n.m.java.JExtCG.refresh(JExternalCompilerGroup.java:574)
at o.n.m.java.JExtCG.refresh(JExternalCompilerGroup.java:574)
at o.n.m.java.JExtCG.refreshFS(JExternalCompilerGroup.java:554)
at o.n.m.java.JExtCG.start(JExternalCompilerGroup.java:197)
at o.n.core.compiler.CEImpl$CT$GC.run(CompilationEngineImpl.java:280)

Nevertheless the SFS refresh take ~400-800ms (Why is SFS actually
marked as "Use in compiler?"), but the CVSFS, on which I had the
source, took 1300-3300ms ;-( while the refresh of the LocalFS
over the same data took ~500ms

Comment 4 Petr Nejedly 2003-03-26 11:05:45 UTC
Now, the strange thing is that you do explictely recursive refresh
forcing initialization of the FO's nobody is yet interrested in.
Is it neccessary?
Wouldn't fs.refresh(true) be sufficient?
(Why does a "refresh" of never used JavaCVS FS take 3s?)
Comment 5 Petr Nejedly 2003-03-27 10:45:43 UTC
I've tested the fs.refresh() approach and it works correctly
and is *way* faster. For some people (phrebejk with ~20 JavaCVS
FSes mounted), it makes a difference of ~97% (60s vs. 2s, he was
complaining very loudly...)
We should certainly fix this for 3.5
Comment 6 _ ttran 2003-03-27 12:36:54 UTC
> We should certainly fix this for 3.5

agreed
Comment 7 Svata Dedic 2003-03-27 13:40:26 UTC
Created attachment 9566 [details]
Proposed patch
Comment 8 Svata Dedic 2003-03-27 13:51:53 UTC
Fixed in trunk: 
 
/cvs/java/src/org/netbeans/modules/java/JExternalCompilerGroup.java,v  
<--  JExternalCompilerGroup.java 
new revision: 1.47; previous revision: 1.46 
 
Comments: 
I excluded SFS from the refresh entirely; don't know why it has 
COMPILE capability, but will not dare to change that for 3.5 (and it will 
be hopefully trashed for the next version). 
 
The recursive refresh refreshes one level more: it refreshes pre-existing 
directories, which may not yet read their children (so it creates 
additional FileObjects). 
On the contrary, FileSystem.refresh() refreshes all live objects, so as I 
understand it, it will do equivalent of refresh() even on .properties, .gif 
and other files, which were ignored by the refresh code implemented in 
External Compiler (it avoided calling refresh() on them, if they were 
refreshed as a part of their parent refresh, file a bug against 
filesystems). 
Please attach a measurement for local filesystem, too. 
 
I do not consider this an appropriate fix for NetBeans 4.0, because the 
number of live FileObjects will become the union of all opened projects 
and the difference between number of operations done by 
HostFS.refresh() and refresh of only some files in some subtrees 
(targets of compilation) will be potentially great. 
 
Comment 9 Petr Nejedly 2003-03-27 14:14:53 UTC
For LocalFS, when I was testing it, the times were like 500ms vs 50ms
but it depends on many factors, like the number of live FOs.
The patch looks OK, I was trying about the same.


Without the fix, the JExtCG would spend quite some time even
on the filesystems which are collapsed in the explorer and otherwise
idle (as you said).

To the selective refresh: filesystems library is perfectly prepared
for this functionality so implementing it is just a question of
consensus and few lines of code.
Radek agreed it is a reasonable request so you can expect
something like FileObject.refresh(boolean expected, boolean recursive)
Comment 10 Svata Dedic 2003-03-27 14:34:28 UTC
OK, great; for 3.* the difference b/w selective and full refresh of live 
FOs should not be so visible anyway, as all the FOs are used in the 
(single) opened project. 
Comment 11 Svata Dedic 2003-03-27 14:52:59 UTC
Created attachment 9570 [details]
Binary patch for testing
Comment 12 Svata Dedic 2003-03-27 14:53:52 UTC
Unzip the patch in the installation directory & play. 
Comment 13 Tomas Zezula 2003-03-27 17:43:49 UTC
The patch is OK.
Comment 14 Jan Becicka 2003-03-28 08:32:09 UTC
The patch seems to be OK from QA point of view.
Comment 15 _ ttran 2003-03-28 09:09:08 UTC
approved for 3.5
Comment 16 Svata Dedic 2003-03-28 14:57:31 UTC
Merged into rel35: 
 
/cvs/java/src/org/netbeans/modules/java/JExternalCompilerGroup.java,v  
<--  JExternalCompilerGroup.java 
new revision: 1.46.2.1; previous revision: 1.46 
 
Comment 17 Petr Nejedly 2003-03-31 12:23:43 UTC
Cool!