Skip to content

Commit d1e15a2

Browse files
committed
DO NOT MERGE, brute force change in LocationMap
LocationMap should use HashMap for better performance Fixes #2251
1 parent f752dd4 commit d1e15a2

File tree

1 file changed

+3
-13
lines changed
  • resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources

1 file changed

+3
-13
lines changed

resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/AliasManager.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
import java.util.HashMap;
2525
import java.util.HashSet;
2626
import java.util.List;
27+
import java.util.Map;
2728
import java.util.Map.Entry;
2829
import java.util.Set;
29-
import java.util.SortedMap;
30-
import java.util.TreeMap;
3130
import java.util.concurrent.ConcurrentHashMap;
3231
import java.util.function.Consumer;
3332
import org.eclipse.core.filesystem.EFS;
@@ -134,7 +133,7 @@ class LocationMap {
134133
/**
135134
* Map of FileStore->IResource OR FileStore->ArrayList of (IResource)
136135
*/
137-
private final SortedMap<IFileStore, Object> map = new TreeMap<>(IFileStore::compareTo);
136+
private final Map<IFileStore, Object> map = new HashMap<>(10_000);
138137

139138
/**
140139
* Adds the given resource to the map, keyed by the given location.
@@ -177,16 +176,7 @@ public void clear() {
177176
* given location as a prefix.
178177
*/
179178
public void matchingPrefixDo(IFileStore prefix, Consumer<IResource> doit) {
180-
SortedMap<IFileStore, Object> matching;
181-
IFileStore prefixParent = prefix.getParent();
182-
if (prefixParent != null) {
183-
//endPoint is the smallest possible path greater than the prefix that doesn't
184-
//match the prefix
185-
IFileStore endPoint = prefixParent.getChild(prefix.getName() + "\0"); //$NON-NLS-1$
186-
matching = map.subMap(prefix, endPoint);
187-
} else {
188-
matching = map;
189-
}
179+
Map<IFileStore, Object> matching = map;
190180
for (Object value : matching.values()) {
191181
if (value == null) {
192182
return;

0 commit comments

Comments
 (0)