Bug 20960 - [CVS Core] Putting resources under version control creates lots of garbage
Summary: [CVS Core] Putting resources under version control creates lots of garbage
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2002-06-25 13:05 EDT by Tim Ellison CLA
Modified: 2004-03-01 12:23 EST (History)
1 user (show)

See Also:


Attachments
allocations of Object[] while sharing a project (41.07 KB, text/html)
2003-02-12 13:56 EST, John Arthorne CLA
no flags Details
Allocations of StringMatcher while sharing a project (28.06 KB, text/html)
2003-02-12 13:56 EST, John Arthorne CLA
no flags Details
Implementation of the solution described in Kevin's comment (2.68 KB, patch)
2003-02-21 16:19 EST, Boris Shingarov CLA
no flags Details | Diff
Allocation backtrace while updating syncinfo (6.05 KB, text/plain)
2003-03-05 11:58 EST, Boris Shingarov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Ellison CLA 2002-06-25 13:05:33 EDT
Build 20020624 (GM1)

Bringing a large project (11K files, 620 folders) under version control is very 
slow, and, watching the VM output on verbose GC shows eclipse is trying to 
allocate increasing blocks of memory (see below).

About every ten seconds Eclipse is grabbing 5Mb -> 6Mb (increasing) of memory, 
which is subsequently collected (along with much more memory not shown).

Just a heads up in case there is some problem with building a synch tree, or 
such like.

...
<AF[117]: Allocation Failure. need 5664216 bytes, 2684 ms since last AF>
<AF[118]: Allocation Failure. need 5707720 bytes, 10256 ms since last AF>
<AF[119]: Allocation Failure. need 5750192 bytes, 10730 ms since last AF>
<AF[120]: Allocation Failure. need 5788056 bytes, 9529 ms since last AF>
<AF[121]: Allocation Failure. need 5823928 bytes, 9324 ms since last AF>
<AF[122]: Allocation Failure. need 5859544 bytes, 9836 ms since last AF>
<AF[123]: Allocation Failure. need 5893744 bytes, 8909 ms since last AF>
<AF[124]: Allocation Failure. need 5928424 bytes, 9111 ms since last AF>
<AF[125]: Allocation Failure. need 5954712 bytes, 7209 ms since last AF>
<AF[126]: Allocation Failure. need 5989344 bytes, 9113 ms since last AF>
<AF[127]: Allocation Failure. need 6027272 bytes, 10119 ms since last AF>
<AF[128]: Allocation Failure. need 6062616 bytes, 10122 ms since last AF>
<AF[129]: Allocation Failure. need 6091000 bytes, 7888 ms since last AF>
<AF[130]: Allocation Failure. need 6119640 bytes, 8888 ms since last AF>
<AF[131]: Allocation Failure. need 6146864 bytes, 7714 ms since last AF>
<AF[132]: Allocation Failure. need 6173464 bytes, 7701 ms since last AF>
<AF[133]: Allocation Failure. need 6200784 bytes, 8286 ms since last AF>
<AF[134]: Allocation Failure. need 6228112 bytes, 7657 ms since last AF>
<AF[135]: Allocation Failure. need 6253448 bytes, 8051 ms since last AF>
<AF[136]: Allocation Failure. need 6285536 bytes, 9237 ms since last AF>
<AF[137]: Allocation Failure. need 6318144 bytes, 9736 ms since last AF>
<AF[138]: Allocation Failure. need 6341000 bytes, 13332 ms since last AF>
...
Comment 1 Kevin McGuire CLA 2002-06-25 13:11:49 EDT
For bug completeness, which vm/jdk are you using Tim?
Comment 2 Kevin McGuire CLA 2002-06-25 13:12:23 EDT
post 2.0 investigation
Comment 3 Tim Ellison CLA 2002-06-26 03:55:06 EDT
I'm running with IBM JDK 1.3.1
Comment 4 Kevin McGuire CLA 2002-09-04 16:48:16 EDT
reopening for 2.1 performance work
Comment 5 Boris Shingarov CLA 2003-02-11 11:14:55 EST
Profiling memory shows that these allocations occur during combining deltas in
core.  Transferring to core for further investigation.
Comment 6 John Arthorne CLA 2003-02-12 12:28:02 EST
I will investigate
Comment 7 John Arthorne CLA 2003-02-12 13:55:31 EST
The allocations are actually occurring in CVS code.  It is asking each resource
if it is ignored, which creates StringMatcher objects (which contain strings,
vectors,  StringBuffers, etc).  Sharing a project with 12,000 files created
110MB of garbage, most of which is allocated within isIgnored.  Will attach some
allocation back traces from OptimizeIt.  Michael thinks the following code (in
EclipseFolder#members) is the culprit (note that it checks ignore state even if
it is not interested in processing it):

boolean isManaged = cvsResource.isManaged();
boolean isIgnored = cvsResource.isIgnored();
if ((isManaged && includeManaged)|| (isIgnored && includeIgnored)
		|| ( ! isManaged && ! isIgnored && includeUnmanaged)) {
	boolean exists = cvsResource.exists();
	if ((includeExisting && exists) || (includePhantoms && !exists)) {
		result.add(cvsResource);
	}
}
Comment 8 John Arthorne CLA 2003-02-12 13:56:20 EST
Created attachment 3451 [details]
allocations of Object[] while sharing a project
Comment 9 John Arthorne CLA 2003-02-12 13:56:42 EST
Created attachment 3452 [details]
Allocations of StringMatcher while sharing a project
Comment 10 Kevin McGuire CLA 2003-02-20 18:55:50 EST
Solution:

1. keep a static list of StringMatchers, one for every ignore pattern
2. lazy init the list from Team.getAllTypes()
3. clear list from Team.setAllIgnores()
4. in Team.isIgnored, iterate through the StringMatchers instead of the 
patterns
Comment 11 Boris Shingarov CLA 2003-02-21 16:19:48 EST
Created attachment 3641 [details]
Implementation of the solution described in Kevin's comment

This does speed up the first stage.  The problem remains with the part where we
combine deltas.  I am investigating and will attach the exact breakup.
Comment 12 Kevin McGuire CLA 2003-02-27 15:48:36 EST
We should do the same fix for the default cvs ignore list (see Michael V).
Comment 13 Michael Valenta CLA 2003-03-03 16:28:19 EST
The fix from Boris has been applied. It turns out that CVS doesn't even use the 
API from Team. The reason is that the API takes IFile but CVS needs to check 
IResource. We've updated the API (any objections Kevin?) and modified the CVS 
code to use it and cache it's internal ignores as StringMatchers as well.
Comment 14 Kevin McGuire CLA 2003-03-03 18:24:19 EST
Hmm, since one would want to ignore folders, taking IFile seems like it was 
bogus.

>>We've updated the API (any objections Kevin?)

So you've widened the type of the field from being IFile to IResource?  I guess 
this can't break anyone.
Comment 15 Boris Shingarov CLA 2003-03-05 11:57:11 EST
I re-profiled it with the last code (i.e., with StringMatchers fixed for core 
and cvs).

While this does speed up the adding stage, it does not affect the original 
behavior mentioned by Tim, that is grabbing progressively bigger memory 
chunks.  As I pointed out a few comments above:  the memory gets allocated in 
AbstractDataTreeNode.assembleWith() during the cvs sync info update phase.
Comment 16 Boris Shingarov CLA 2003-03-05 11:58:42 EST
Created attachment 3851 [details]
Allocation backtrace while updating syncinfo
Comment 17 Boris Shingarov CLA 2003-03-05 12:13:04 EST
Reassigning to core, for comment on assembleWith().
Comment 18 John Arthorne CLA 2004-03-01 12:23:40 EST
Stale bug. Closing.