Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2021-08-05 19:40:02 +0000
committerAndrey Loskutov2021-08-06 11:24:47 +0000
commit697ed6cd9c6828a9ea5c03d70d5eda2b14120f68 (patch)
tree151e424251a271985ebfbcb93602ec923a77ed84
parent9917c2fa5a80e5111cfd50e07f1c0dda24ffbcbe (diff)
downloadeclipse.platform.text-697ed6cd9c6828a9ea5c03d70d5eda2b14120f68.tar.gz
eclipse.platform.text-697ed6cd9c6828a9ea5c03d70d5eda2b14120f68.tar.xz
eclipse.platform.text-697ed6cd9c6828a9ea5c03d70d5eda2b14120f68.zip
isMatchToBeIncluded() iterated over every element of the already processed matches map to check if file matches are equal according to URIUtil criteria. However, that is only needed if same file match is not yet in the map - so for every match on same file we iterated through all map keys, instead of immediate map lookup & return. That greatly speeds up initial text replace preparation on search with few matches per file and many files. Change-Id: Id620232098142e27f823344501630c891ad16afc Signed-off-by: Andrey Loskutov <loskutov@gmx.de> Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.text/+/183748 Tested-by: Platform Bot <platform-bot@eclipse.org> Reviewed-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
index 6a5ea1b7dcf..9409edb7d68 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
@@ -292,24 +292,25 @@ public class ReplaceRefactoring extends Refactoring {
private boolean isMatchToBeIncluded(FileMatch match) {
IFile file= match.getFile();
URI uri= file.getLocationURI();
- if (uri == null)
+ if (uri == null) {
return true;
+ }
+ if (file.equals(fAlreadyCollected.get(uri))) {
+ return true; // another FileMatch for an IFile which already had
+ // matches
+ }
for (URI uri2 : fAlreadyCollected.keySet()) {
if (URIUtil.equals(uri2, uri)) {
- if (file.equals(fAlreadyCollected.get(uri)))
- return true; // another FileMatch for an IFile which already had matches
-
- if (fIgnoredMatches == null)
+ if (fIgnoredMatches == null) {
fIgnoredMatches= new HashMap<>();
-
+ }
ArrayList<FileMatch> matches= fIgnoredMatches.get(uri);
if (matches == null) {
matches= new ArrayList<>();
fIgnoredMatches.put(uri, matches);
}
matches.add(match);
-
return false;
}
}

Back to the top