Bug 331882 - Unnecessary calls to getProjectDescription(IProject, true) are very expensive
Summary: Unnecessary calls to getProjectDescription(IProject, true) are very expensive
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 8.0   Edit
Assignee: James Blackburn CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2010-12-06 01:43 EST by Marko Tomljenovic CLA
Modified: 2011-02-13 12:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Tomljenovic CLA 2010-12-06 01:43:12 EST
Build Identifier: 7.0.1

Hello everybody,
I just encountered a use case where I thought that the CDT Indexer is stuck in a deadlock.
In fact it was just so slow that I thought it is a deadlock.

My case:
    ~18 000 symbols set per external settings provider (before the indexer is executed the first time)
    ~6000 src files in the project

Then the Indexer seems to stop at "Collecting files".

Why does it seem like that:
In AbstractIndexerTask.extractFiles for each file TranslationUnit.getLanguage is called.
getLanguage is then calling always: CoreModel.getDefault().getProjectDescription(project, -->true<--);

This means making a copy of the 18k symbols for 6000 files ==> soooo slow

Wouldn't a read access to the project description be enough for determining the language? Then the cached one could be used by all files.


Reproducible: Always
Comment 1 James Blackburn CLA 2010-12-06 05:00:47 EST
There are a number of places which use the suboptimal API:
  - getProjectDescription(IProject, true)
  - getProjectDescription(IProject)

where they only need a read-only copy of the project description.  Should do a survey of these uses and change where appropriate.
Comment 2 James Blackburn CLA 2011-02-13 11:29:48 EST
Fixed in HEAD. A writable description is not needed to determine the language.