Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 69078

Summary: C/C++ indexer too slow
Product: [Tools] CDT Reporter: Ed Burnette <ed.burnette>
Component: cdt-parserAssignee: Bogdan Gheorghe <gheorghe>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2 CC: jave27, Jeff.Polzin, Mikhail.Voronin, mlists, nikolaymetchev, oleg.krasilnikov, sreinstein, weisen123+bugzilla
Version: 2.0   
Target Milestone: 3.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Job Manager delay elimination
angvoz.dev: iplog-
Test to check indexing performance
none
Test to check indexing performance
none
Test case for indexing performance.
angvoz.dev: iplog-
Sample data for CDT index parformance test
none
Sample data (part 2) for CDT index performance test none

Description Ed Burnette CLA 2004-06-30 16:32:48 EDT
Eclipse 3.0 + cdt.sdk-I200406280300-win32
I'm trying to get CDT to work with a small project that has 97 .c files and 
80 .h files, about 130K lines (plus two external h file directories). I can 
compile and link the whole thing in about a minute but the C/C++ Indexer takes 
over 30 minutes. Looking at the task monitor it appears to be CPU bound (I 
have a dual-Xeon 1.8Ghz XP box). We do tend to make heavy use of the 
preprocessor.
Comment 1 Bogdan Gheorghe CLA 2004-06-30 16:54:13 EDT
Would it be possible for you to zip up and attach your workspace?
Comment 2 Ed Burnette CLA 2004-06-30 16:56:33 EDT
I just downloaded CDT RC2 and it seems to be faster. After reinstalling CDT 
and restarting Eclipse I closed and reopened my project, which triggered an 
index rebuild which took 7 minutes and 10 seconds.

The project is proprietary closed source so I can't zip it up for you, sorry.
Comment 3 Ed Burnette CLA 2004-06-30 17:42:11 EDT
I added some more (hopefully the last of the) external header file directories 
and the it took 17 minutes and 30 seconds to rebuild the index with RC2. 
According to task manager it seems to be more I/O bound now, with only about 
40% CPU utilization. The external header files are on a fast network drive. 
But a file monitor tool shows that the same headers are being searched, 
opened, and read over and over during the indexing process.
Comment 4 Bogdan Gheorghe CLA 2004-07-05 10:39:01 EDT
We are planning a number of performance improvements for the next point 
release which will improve the overall speed of the indexing operation by 
caching common include files and improving I/O performance when creating the 
index.
Comment 5 Johan Walles CLA 2005-08-02 04:30:23 EDT
This sounds like it could be related to bug 81769.
Comment 6 Jintao Yin CLA 2005-10-03 07:18:47 EDT
I think it is too slow anyhow,even with basic includes and a main file,eclipse 
will exhaust all CPU usage and lose response.I have to kill it to continue 
working with my PC.
Comment 7 Ahmed Ayad CLA 2005-10-07 16:25:09 EDT
I would also add that it takes too much time to update the indexer data. I have
a small sized project (~150 files). If I change something in one of them, it
takes the indexer about 30sec-1min to update.
Comment 8 Wallace Chen CLA 2005-11-16 21:53:48 EST
With slow, it also ocuppies too much memory. In my system, the memory occupied
is up to 600M, and increase continuely.

My System:
CPU: P4 2.4G
Memory: 1024M
OS: Windows 2000
Eclipse: 3.1.1
CDT: 3.0.1
Compiler: MinGW 3.1

C/C++ project only includes one main.cpp file, the C/C++ indexer occupies 99%
CPU Usage and about 500M memory, and takes more than 5 minutes every time I
change the source.
Comment 9 Oleg Krasilnikov CLA 2005-12-23 06:31:18 EST
Created attachment 32196 [details]
Job Manager delay elimination

Currently, JobManager.run() (see code below) waits 50 ms after _every_ background job finished.
May be it's reasonable in some cases (allow concurrent processes to run), but during indexation
we are spending this time after each separate file processed ! 

When I have commented this delay (as shown below), indexing process has finished much faster.
Saved time depends of project, but it is significant in any case:

~25% on "C" Midninght Commander source.
~45-50% on "C++" Mozilla source

It seems to be we can improve indexing performance either by removing this delay at all,
or by decreasing waiting time as possible.
Comment 10 Oleg Krasilnikov CLA 2005-12-23 06:33:05 EST
Created attachment 32197 [details]
Test to check indexing performance

Simple indexing performance test to org.eclipse.core.tests.
This test can be used, in particular, to check a gain of 
previous modification.
Comment 11 Oleg Krasilnikov CLA 2005-12-23 06:33:13 EST
Created attachment 32198 [details]
Test to check indexing performance

Simple indexing performance test to org.eclipse.core.tests.
This test can be used, in particular, to check a gain of 
previous modification.
Comment 12 Oleg Krasilnikov CLA 2006-01-11 07:48:12 EST
Comment on attachment 32197 [details]
Test to check indexing performance

Zip file was added below as separate attach. Current patch is not required now.
Comment 13 Oleg Krasilnikov CLA 2006-01-11 07:51:42 EST
Created attachment 32830 [details]
Test case for indexing performance.

The test case requires sample source files to index.
This sample data will be attached as separate zip file.
Comment 14 Oleg Krasilnikov CLA 2006-01-11 07:55:09 EST
Created attachment 32831 [details]
Sample data for CDT index parformance test

File should be placed to org.eclipse.cdt.core.tests\resources\zips\
Comment 15 Oleg Krasilnikov CLA 2006-01-11 07:58:13 EST
Created attachment 32832 [details]
Sample data (part 2) for CDT index performance test

File should be placed to org.eclipse.cdt.core.tests\resources\zips\
Comment 16 Jason Green CLA 2006-01-12 19:20:43 EST
Also experiencing this issue on Ubuntu Breezy AMD64 with an AMD64 3400+ processor and 1GB RAM.  Working on a project (Pingus) with about 1000 total files if you include the game engine (ClanLib).  It takes *way* too long to reindex, and it does it just about every time I open the project.  Slows the entire system down to a crawl.

Specs:
* Java JDK 1.5.0 AMD64
* Eclipse 3.1.1
* CDT 3.0.1
* Ubuntu Breezy with gcc 4.0.2 (if that matters)

Let me know if you need any files.   I've eventually had to go back to setting CDT to using "No Indexer", so it's usuable now.  Thanks!
Comment 17 Oleg Krasilnikov CLA 2006-01-26 05:31:56 EST
This bug has been submitted long time ago and targeted to "Future"
I propose to change target to CDT 3.0.2 and add all patches (or,
at least, 1st one) to this release.

Code patch itself is local, it affects 1 method only.
Test case with sample data does not affect CDT execution flow.
So it seems like it can be accepted in 3.0.2. 
Comment 18 Alex Blewitt CLA 2006-03-01 08:38:04 EST
Ed, you've raised this against the 2.0 stream, when it probably meant 3.0 stream. Do you want to change the version number to something slightly higher so that it gets on their radar? I'm guessing that unless it has 3.2 on it, it's not going to get addressed any time soon ...
Comment 19 Ed Burnette CLA 2006-03-01 10:43:38 EST
I think we're supposed to leave the version number alone so it represents when the problem was first noticed.

BTW I'm not currently using CDT because of this problem and a few others (e.g., dealing with thousands of include files, partially instantiated playpens, and our wierd custom build system, etc.) so somebody else will have to say if the problem still exists in current versions, sorry.
Comment 20 Oleg Krasilnikov CLA 2006-03-03 08:01:16 EST
Since proposed fix is applicable to CDT 3.1, I have changed target.

I agree that current problem is too global (applicable both to 2.0,
3.0, 3.1 CDT and so on). But, new its incarnations can be tracked 
by bugs. I propose to close this item after patches will be applied.
It will be done today.
Comment 21 Oleg Krasilnikov CLA 2006-03-03 08:34:00 EST
Code patch is applied.
Tests will be delivered soon.
Comment 22 Oleg Krasilnikov CLA 2006-03-10 08:17:45 EST
Test patch is applied today. 
Sample data also added. 

Comment 23 Nikolay Metchev CLA 2006-03-10 09:25:09 EST
Pardon my ignorance but does the resolution of this bug solve bug 105803 and bug 81769?
In particular as Bug 105803 points out it takes 7 hours to index the mozilla source. Has that figure changed much?
Comment 24 Oleg Krasilnikov CLA 2006-03-10 10:11:54 EST
Nikolay, 

you are right, mentioned bugs are related to current one.
Moreover, bug 105803 is may be the better place for such
fixes. But I was not aware of it when I've created patch
in current bug. It's not nice but it cannot be redone.

What about the problem resolution. I can say: "partially".

There were some separate fixes related to indexer performance. 
Most of them are to be included to CDT 3.1. So we will see their 
cumulative effect. May be it will run twice as faster. May be by 
50%, or even 20% only. But I hope that result be visible anyway. 

From the other hand, even triple or quadruple speed-up will not 
satisfy users completely: "My project indexation runs 2 hours ! 
It is terrible !" It's true even we have had 7 hours before.

So, bug #105803 can be left open forever: we'll always
have anything to speed-up in indexer.  But current bug
have no any reason to be still opened. May be it would
be better to mark such bugs as duplicated.

Moreover, PDOM implementation will made Full Indexer 
problems less actual.