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 40744 - vcscore performance problem
Summary: vcscore performance problem
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: vcscore (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2004-03-03 21:06 UTC by Isao Yanagimachi
Modified: 2004-03-08 15:48 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch file for CacheDir.java (4.54 KB, patch)
2004-03-03 21:09 UTC, Isao Yanagimachi
Details | Diff
Patch file for CacheReference.java (1.67 KB, patch)
2004-03-03 21:11 UTC, Isao Yanagimachi
Details | Diff
Patch file for ExcuteCommand.java (7.22 KB, patch)
2004-03-03 21:11 UTC, Isao Yanagimachi
Details | Diff
Patch file for VcsCacheDir.java (11.19 KB, patch)
2004-03-03 21:12 UTC, Isao Yanagimachi
Details | Diff
Patch file for VcsCacheFile.java (3.46 KB, patch)
2004-03-03 21:13 UTC, Isao Yanagimachi
Details | Diff
Patch file for VcsFileSystem.java (1.77 KB, patch)
2004-03-03 21:13 UTC, Isao Yanagimachi
Details | Diff
The final contextual diff. (29.60 KB, patch)
2004-03-04 15:29 UTC, Martin Entlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Isao Yanagimachi 2004-03-03 21:06:19 UTC
Hi,

I am developing a source control profiler using
vcsgeneric, and having a problem with vcsgeneric 
when there are many files in the folder being 
refreshed.

The details are at 
http://www.netbeans.org/servlets/ReadMsg?
msgId=698985&listName=nbdev

Running VCS commands takes very long time, and 
even throws the out of memory exception.


/Isao Yanagimachi

Hewlett-Packard
Comment 1 Isao Yanagimachi 2004-03-03 21:08:28 UTC
Hi,

I have created some patches which fix some 
bugs and improve the performance of the vcscore. 

These patches reduce the frequency of cache 
updates to and from the disk, and keep the memory 
footprint of cache small.  The number of file 
system refreshes is also reduced.

We are working on a VCS profile for vcsgeneric 
(for our proprietary code management system (CMS) )
and these patches are required. 

If at all possible, we'd like to be able to have 
these patches reviewed and incorporated into 3.6.  
Could someone review them ASAP and get back to us?

Related nbdev link :
http://www.netbeans.org/servlets/ReadMsg?msgId=698985&listName=nbdev

Thanks

/Isao Yanagimahci
Hewlett-Packard
Comment 2 Isao Yanagimachi 2004-03-03 21:09:25 UTC
Created attachment 13810 [details]
Patch file for CacheDir.java
Comment 3 Isao Yanagimachi 2004-03-03 21:11:04 UTC
Created attachment 13811 [details]
Patch file for CacheReference.java
Comment 4 Isao Yanagimachi 2004-03-03 21:11:52 UTC
Created attachment 13812 [details]
Patch file for ExcuteCommand.java
Comment 5 Isao Yanagimachi 2004-03-03 21:12:28 UTC
Created attachment 13813 [details]
Patch file for VcsCacheDir.java
Comment 6 Isao Yanagimachi 2004-03-03 21:13:14 UTC
Created attachment 13814 [details]
Patch file for VcsCacheFile.java
Comment 7 Isao Yanagimachi 2004-03-03 21:13:58 UTC
Created attachment 13815 [details]
Patch file for VcsFileSystem.java
Comment 8 Martin Entlicher 2004-03-04 10:04:55 UTC
Thanks Isao, starting to look at it...
Comment 9 Martin Entlicher 2004-03-04 15:24:16 UTC
I've reviewed the patch. It looks good, especially the optimized
refreshing in ExecuteCommand and cache reading in CacheDir.

I've made some minor correction in CacheFile.getFiles() and removed
all methods which manipulated with siblings from VcsCacheFile and
VcsCacheDir. I'm a little worried of the change from WeakReference to
SoftReference, but when I test both options I didn't encounter a
significant difference in memory consumption. Since SoftReference
should the cache performance, I'll leave there SoftReference.

I've tested the patch with CVS profile and I didn't encounter any
functional problems. I didn't measure the performance, but during the
tests it seemed to be faster.

I've committed the patch into trunk and I'll try to get it into 3.6.

/cvs/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java,v 
<--  VcsFileSystem.java
new revision: 1.250; previous revision: 1.249
done
Checking in cache/CacheDir.java;
/cvs/vcscore/src/org/netbeans/modules/vcscore/cache/CacheDir.java,v 
<--  CacheDir.java
new revision: 1.35; previous revision: 1.34
done
Checking in cache/CacheReference.java;
/cvs/vcscore/src/org/netbeans/modules/vcscore/cache/CacheReference.java,v
 <--  CacheReference.java
new revision: 1.9; previous revision: 1.8
done
Checking in caching/VcsCacheDir.java;
/cvs/vcscore/src/org/netbeans/modules/vcscore/caching/VcsCacheDir.java,v
 <--  VcsCacheDir.java
new revision: 1.49; previous revision: 1.48
done
Checking in caching/VcsCacheFile.java;
/cvs/vcscore/src/org/netbeans/modules/vcscore/caching/VcsCacheFile.java,v
 <--  VcsCacheFile.java
new revision: 1.18; previous revision: 1.17
done
Checking in cmdline/ExecuteCommand.java;
/cvs/vcscore/src/org/netbeans/modules/vcscore/cmdline/ExecuteCommand.java,v
 <--  ExecuteCommand.java
new revision: 1.74; previous revision: 1.73
Comment 10 Martin Entlicher 2004-03-04 15:25:22 UTC
Oops, Target Milestone must be "promo-D" until it's merged into
release36 branch.
Comment 11 Martin Entlicher 2004-03-04 15:29:51 UTC
Created attachment 13827 [details]
The final contextual diff.
Comment 12 _ rkubacki 2004-03-04 20:16:55 UTC
thanks Isao.

Do we have any measurable case where the improvement can be demonstrated?

Ad Soft vs. Weak references: soft refs are cleared when there is a
demand for more memory so it will not reclaim objects so easily. When
the weak refs are freed and how soft refs help? Do we now?

I am eager to see as many performance enhancements in the IDE as
possible but would like to see some hard numbers.
Comment 13 mgarrison 2004-03-04 20:22:18 UTC
We can give you some performance numbers for our generic profile for 
CMS.  The difference is astonishing really.  Isao will post them 
this afternoon.

Thanks for consideration.

Meg
Comment 14 Isao Yanagimachi 2004-03-05 00:30:11 UTC
>Do we have any measurable case where the improvement can be 
>demonstrated

yes.

Environment : P4(2.4 2CPU) 1G RAM machine with XP. The files were  
              under the network mounted share. 

* With all the vcscore patches applied :

     Refreshing 1500 files took about 5-6 sec. Updating 750 files 
     from scratch took about 34 sec.

* Without patches being applied :

     Refreshing 1500 files caused out of memory exception from 
     NetBeans after a while. Updating 750 files from scratch took 
     about 45  sec.

Basically I observed more performance gain as the number of files 
increased.

>When the weak refs are freed and how soft refs help? Do we now?

With just the Refernece patch alone, and refreshing about 800 files,
it took at least 4 more secs to refresh using WeakReference versus 
SoftReference. I think this is because refreshing in vcscore is 
expensive in that once the file reference is cleared, it requires 
buffered file IO to recreate the cache.  And when refreshing many 
number of files in vcscore , many of the file references are cleared 
and reclaimed. So IMHO at least in the case of vcscore where 
reclaiming file references is expensive, I think SoftReference has 
advantage.


Isao
Comment 15 Milan Kubec 2004-03-08 14:39:09 UTC
QA, please, verify the fix in trunk build. Thanks.
Comment 16 Antonin Nebuzelsky 2004-03-08 15:15:09 UTC
I verified with trunk builds that the improvement for Refresh is
significant. Having a local CVS repository with 1500 simple java files
in a single directory I did refresh. With a build prior to this patch
I ran into OOME and after 51 seconds the refresh command failed
completely. With a build with the patch the refresh finished
successfully within 15 seconds.
Comment 17 Martin Entlicher 2004-03-08 15:48:05 UTC
Thanks for the verification.
The fix is merged into release36 branch:

Checking in src/org/netbeans/modules/vcscore/VcsFileSystem.java;
/shared/data/helm/cvs/repository/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java,v
 <--  VcsFileSystem.java
new revision: 1.249.2.1; previous revision: 1.249
done
Checking in src/org/netbeans/modules/vcscore/cache/CacheDir.java;
/shared/data/helm/cvs/repository/vcscore/src/org/netbeans/modules/vcscore/cache/CacheDir.java,v
 <--  CacheDir.java
new revision: 1.34.18.1; previous revision: 1.34
done
Checking in src/org/netbeans/modules/vcscore/cache/CacheReference.java;
/shared/data/helm/cvs/repository/vcscore/src/org/netbeans/modules/vcscore/cache/CacheReference.java,v
 <--  CacheReference.java
new revision: 1.8.150.1; previous revision: 1.8
done
Checking in src/org/netbeans/modules/vcscore/caching/VcsCacheDir.java;
/shared/data/helm/cvs/repository/vcscore/src/org/netbeans/modules/vcscore/caching/VcsCacheDir.java,v
 <--  VcsCacheDir.java
new revision: 1.48.2.1; previous revision: 1.48
done
Checking in src/org/netbeans/modules/vcscore/caching/VcsCacheFile.java;
/shared/data/helm/cvs/repository/vcscore/src/org/netbeans/modules/vcscore/caching/VcsCacheFile.java,v
 <--  VcsCacheFile.java
new revision: 1.17.2.1; previous revision: 1.17
done
Checking in src/org/netbeans/modules/vcscore/cmdline/ExecuteCommand.java;
/shared/data/helm/cvs/repository/vcscore/src/org/netbeans/modules/vcscore/cmdline/ExecuteCommand.java,v
 <--  ExecuteCommand.java
new revision: 1.73.2.1; previous revision: 1.73
done