Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313027 - [performance] Rename refactoring is very slow on large projects
Summary: [performance] Rename refactoring is very slow on large projects
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 major with 2 votes (vote)
Target Milestone: 8.0   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Emanuel Graf CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-15 20:38 EDT by Sergey Prigogin CLA
Modified: 2010-06-30 14:23 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (28.13 KB, patch)
2010-06-30 14:02 EDT, Sergey Prigogin CLA
eclipse.sprigogin: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Prigogin CLA 2010-05-15 20:38:34 EDT
Checking preconditions in Rename refactoring involves reading every file in the project. On very large projects this can take several minutes rendering Rename refactoring unusable. Here is a call stack that demonstrates this behavior:
"ModalContext" prio=10 tid=0x08280c00 nid=0x5ef7 runnable [0x9e6fe000..0x9e6fee04]
   java.lang.Thread.State: RUNNABLE
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:137)
	at org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:362)
	at org.eclipse.core.internal.resources.ContentDescriptionManager$LazyFileInputStream.ensureOpened(ContentDescriptionManager.java:156)
	at org.eclipse.core.internal.resources.ContentDescriptionManager$LazyFileInputStream.read(ContentDescriptionManager.java:168)
	at java.io.InputStream.read(InputStream.java:102)
	at org.eclipse.core.internal.content.LazyInputStream.loadBlock(LazyInputStream.java:99)
	at org.eclipse.core.internal.content.LazyInputStream.ensureAvailable(LazyInputStream.java:64)
	at org.eclipse.core.internal.content.LazyInputStream.read(LazyInputStream.java:119)
	at org.eclipse.core.internal.content.Util.getByteOrderMark(Util.java:119)
	at org.eclipse.core.internal.content.TextContentDescriber.describe(TextContentDescriber.java:49)
	at org.eclipse.core.internal.content.ContentType.describe(ContentType.java:161)
	at org.eclipse.core.internal.content.ContentType.internalGetDescriptionFor(ContentType.java:458)
	at org.eclipse.core.internal.content.ContentTypeCatalog.getDescriptionFor(ContentTypeCatalog.java:356)
	at org.eclipse.core.internal.content.ContentTypeCatalog.getDescriptionFor(ContentTypeCatalog.java:360)
	at org.eclipse.core.internal.content.ContentTypeMatcher.getDescriptionFor(ContentTypeMatcher.java:86)
	at org.eclipse.core.internal.resources.ContentDescriptionManager.readDescription(ContentDescriptionManager.java:436)
	at org.eclipse.core.internal.resources.ContentDescriptionManager.getDescriptionFor(ContentDescriptionManager.java:346)
	at org.eclipse.core.internal.resources.File.internalGetCharset(File.java:255)
	at org.eclipse.core.internal.resources.File.getCharset(File.java:216)
	at org.eclipse.core.internal.resources.File.getCharset(File.java:203)
	at org.eclipse.search.internal.core.text.FileCharSequenceProvider$FileCharSequence.initializeReader(FileCharSequenceProvider.java:276)
	at org.eclipse.search.internal.core.text.FileCharSequenceProvider$FileCharSequence.reset(FileCharSequenceProvider.java:269)
	at org.eclipse.search.internal.core.text.FileCharSequenceProvider.newCharSequence(FileCharSequenceProvider.java:40)
	at org.eclipse.search.internal.core.text.TextSearchVisitor.processFile(TextSearchVisitor.java:260)
	at org.eclipse.search.internal.core.text.TextSearchVisitor.processFiles(TextSearchVisitor.java:196)
	at org.eclipse.search.internal.core.text.TextSearchVisitor.search(TextSearchVisitor.java:172)
	at org.eclipse.search.internal.core.text.TextSearchVisitor.search(TextSearchVisitor.java:184)
	at org.eclipse.search.core.text.TextSearchEngine$1.search(TextSearchEngine.java:54)
	at org.eclipse.cdt.internal.ui.refactoring.rename.TextSearchWrapper.searchWord(TextSearchWrapper.java:261)
	at org.eclipse.cdt.internal.ui.refactoring.rename.CRenameProcessorDelegate.checkFinalConditions(CRenameProcessorDelegate.java:158)
	at org.eclipse.cdt.internal.ui.refactoring.rename.CRenameProcessor.checkFinalConditions(CRenameProcessor.java:187)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:224)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:85)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:121)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 1 Sergey Prigogin CLA 2010-05-17 15:06:00 EDT
> On Mon, May 17, 2010 at 11:49 AM, Mike Kucera <mkucera@ca.ibm.com> wrote:
> I think it does the text search to catch uses of the identifier in inactive
> code blocks.

One possible solution is to limit the text search to the files that contain the original name according to the index. A user could be given a choice between a potentially very slow exhaustive text search and a much faster selective text search.
Comment 2 Marc-André Laperle CLA 2010-06-22 11:08:41 EDT
(In reply to comment #1)
> One possible solution is to limit the text search to the files that contain the
> original name according to the index. A user could be given a choice between a
> potentially very slow exhaustive text search and a much faster selective text
> search.

Hi Sergey, are you working on this or have you made progress? If not, I could take a look, this has been a big issue for me.
Comment 3 Sergey Prigogin CLA 2010-06-22 12:24:13 EDT
I'm working on it.
Comment 4 Marc-André Laperle CLA 2010-06-23 10:16:32 EDT
(In reply to comment #3)
> I'm working on it.

Great! Thanks for the update.
Comment 5 Sergey Prigogin CLA 2010-06-30 14:02:59 EDT
Created attachment 173136 [details]
Proposed fix
Comment 6 Sergey Prigogin CLA 2010-06-30 14:15:53 EDT
Fixed in HEAD > 20100630.
Comment 7 CDT Genie CLA 2010-06-30 14:23:05 EDT
*** cdt cvs genie on behalf of sprigogin ***
Bug 313027 - Rename refactoring is very slow on large projects

[*] Messages.properties 1.4 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/Messages.properties?root=Tools_Project&r1=1.3&r2=1.4
[*] CRenameProcessorDelegate.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameProcessorDelegate.java?root=Tools_Project&r1=1.5&r2=1.6
[*] TextSearchWrapper.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/TextSearchWrapper.java?root=Tools_Project&r1=1.4&r2=1.5
[*] Messages.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/Messages.java?root=Tools_Project&r1=1.2&r2=1.3
[*] CRenameRefactoringInputPage.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameRefactoringInputPage.java?root=Tools_Project&r1=1.5&r2=1.6
[*] CRenameMacroProcessor.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameMacroProcessor.java?root=Tools_Project&r1=1.2&r2=1.3
[*] CRenameIncludeProcessor.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameIncludeProcessor.java?root=Tools_Project&r1=1.2&r2=1.3
[*] CRenameGlobalProcessor.java 1.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameGlobalProcessor.java?root=Tools_Project&r1=1.1&r2=1.2
[*] CRefactory.java 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRefactory.java?root=Tools_Project&r1=1.6&r2=1.7