Reduce memory consumption

This commit is contained in:
Alexey Andreev 2024-03-18 18:05:06 +01:00
parent 622006de0e
commit 7341fb38a6

View File

@ -295,6 +295,16 @@ class TypeSet {
} }
List<ConsumerWithNode> getConsumers() { List<ConsumerWithNode> getConsumers() {
if (domain == null) {
return List.of();
} else if (domain instanceof DependencyNode) {
var node = (DependencyNode) domain;
if (node.followers == null) {
return List.of();
} else {
return List.of(new ConsumerWithNode(node.followers.toArray(new DependencyConsumer[0]), node));
}
} else {
if (consumers == null) { if (consumers == null) {
consumers = new ArrayList<>(); consumers = new ArrayList<>();
for (var node : domain()) { for (var node : domain()) {
@ -306,6 +316,7 @@ class TypeSet {
} }
return consumers; return consumers;
} }
}
int typeCount() { int typeCount() {
return smallTypes != null ? smallTypes.length : types != null ? typesCount : 0; return smallTypes != null ? smallTypes.length : types != null ? typesCount : 0;