Skip to content

Commit 0b81f44

Browse files
authored
Merge pull request #772 from bohdan-harniuk/uct-enhance-existence-index-performance
UCT-767: Enhanced existence index loading performance
2 parents b426e33 + 3e707ae commit 0b81f44

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/com/magento/idea/magento2uct/versioning/indexes/data/ExistenceStateIndex.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public void setProjectBasePath(final @NotNull String projectBasePath) {
5656
*
5757
* @return boolean
5858
*/
59-
public boolean has(final @NotNull String fqn) {
59+
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
60+
public synchronized boolean has(final @NotNull String fqn) {
6061
groupLoadedData();
6162
version = "";
6263

src/com/magento/idea/magento2uct/versioning/processors/util/VersioningDataOperationsUtil.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import com.google.common.collect.Sets;
99
import com.intellij.openapi.util.Pair;
10-
import java.util.ArrayList;
1110
import java.util.HashMap;
1211
import java.util.List;
1312
import java.util.Map;
@@ -69,7 +68,7 @@ public static Pair<Map<String, Boolean>, Map<String, String>> unionVersionDataWi
6968
final boolean shouldKeepNew
7069
) {
7170
final Map<String, Boolean> union = new HashMap<>();
72-
final List<String> removed = new ArrayList<>();
71+
final Map<String, Boolean> removedUnion = new HashMap<>();
7372
final Map<String, String> changelog = new HashMap<>();
7473

7574
for (final Map.Entry<String, Map<String, Boolean>> vData : versioningData.entrySet()) {
@@ -80,10 +79,11 @@ public static Pair<Map<String, Boolean>, Map<String, String>> unionVersionDataWi
8079
final Map<String, Boolean> removedData = removedSet.stream().collect(
8180
Collectors.toMap(
8281
Map.Entry::getKey,
83-
Map.Entry::getValue
82+
element -> true
8483
)
8584
);
86-
removedData.forEach((key, value) -> removed.add(key));
85+
removedUnion.putAll(removedData);
86+
8787
final Sets.SetView<Map.Entry<String, Boolean>> newDataSet = Sets.difference(
8888
vData.getValue().entrySet(),
8989
removedSet
@@ -102,9 +102,9 @@ public static Pair<Map<String, Boolean>, Map<String, String>> unionVersionDataWi
102102
}
103103
}
104104
}
105-
final Set<Map.Entry<String, Boolean>> filteredUnionSet = Sets.filter(
105+
final Sets.SetView<Map.Entry<String, Boolean>> filteredUnionSet = Sets.difference(
106106
union.entrySet(),
107-
entry -> !removed.contains(entry.getKey())
107+
removedUnion.entrySet()
108108
);
109109
final Map<String, Boolean> filteredUnion = filteredUnionSet.stream().collect(
110110
Collectors.toMap(

0 commit comments

Comments
 (0)