Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314635 - Marking occurrences is very slow on a large file due to searching for implicitReferences
Summary: Marking occurrences is very slow on a large file due to searching for implici...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 7.0   Edit
Hardware: All other
: P3 normal (vote)
Target Milestone: 7.0   Edit
Assignee: Anton Leherbauer CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-27 06:57 EDT by Steve Kennedy CLA
Modified: 2014-07-03 07:13 EDT (History)
3 users (show)

See Also:


Attachments
Short term fix (6.36 KB, patch)
2010-05-28 03:58 EDT, Anton Leherbauer CLA
aleherb+eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Kennedy CLA 2010-05-27 06:57:24 EDT
Build Identifier: M20100211-1343

When using CDT to browse a 40,000 line C++ file, I noticed that clicking on the constructor (specifically the id after the ::) kicks off a long-running worker thread to find other occurrences of the id in the file (for the Mark Occurrencs feature).  This operation locks the AST and takes 15 minutes to complete.  Here is the partial stack trace of the worker thread while running:

...
org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor.getImplicitReferences(CPPVisitor.java:1850)
org.eclipse.cdt.internal.ui.search.OccurrencesFinder.performSearch(OccurrencesFinder.java:75)
org.eclipse.cdt.internal.ui.search.OccurrencesFinder.getOccurrences(OccurrencesFinder.java:103)
org.eclipse.cdt.internal.ui.editor.CEditor.updateOccurrenceAnnotations(CEditor.java:3261)
org.eclipse.cdt.internal.ui.editor.CEditor$7.selectionChanged(CEditor.java:3287)
...

Would it be possible to have the search for implicit references also turned off in this case when the semantic highlighting of overloaded operators is turned off?

Reproducible: Always
Comment 1 Anton Leherbauer CLA 2010-05-28 03:58:11 EDT
Created attachment 170305 [details]
Short term fix

This patch disables mark occurrences for overloaded operators if semantic highlighting for overloaded operators is disabled (which is the default).
This is just a short term fix, because this should rather become a separate preference option for the mark occurrences feature.
Comment 2 Anton Leherbauer CLA 2010-05-28 04:05:55 EDT
Committed to HEAD.  I have opened bug 314813 to add a separate preference option.
Comment 4 csk 200 CLA 2014-07-03 07:13:42 EDT
We are using Kepler SR2 (CDT 8.3.0).

Mark occurrences is slow(1 to 3 minutes)for the large files in the below scenarios:

1. While modifying a large file and if we try to mark occurrences, it is taking 1 to 3 minutes to highlight all the occurrences. If my next action is marking other word, then it is very fast.(My successive markings are fast until I modify or type something). If I type anything, again it repeats 1 to 3 min lag.

2. When we switch from one source file to another, Marking occurrences on the variables are taking longer times to highlight the variables.My successive markings are fast until I switch to another file and back to large file. 

Both the above scenarios can be consistently reproducible. 

If needed, could you please open a new ticket for CDT 8.3.0

Thanks