You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replacing IdentityHashMap with a Map.of(...) when the keys in that map are of several different classes (such as multiple entity classes) will result in System.identityHashCode(...) being replaced by Object.hashCode() - a megamorphic call that the JVM can't optimize.
Copy file name to clipboardExpand all lines: core/src/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/AbstractVariableReferenceGraph.java
+5-23Lines changed: 5 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -43,11 +43,11 @@ public abstract sealed class AbstractVariableReferenceGraph<Solution_, ChangeTra
43
43
nodeList = List.copyOf(outerGraph.nodeList);
44
44
varinstanceCount = nodeList.size();
45
45
// Often the maps are a singleton; we improve performance by actually making it so.
Copy file name to clipboardExpand all lines: core/src/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/DefaultVariableReferenceGraph.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
importjava.util.BitSet;
5
5
importjava.util.IdentityHashMap;
6
6
importjava.util.List;
7
+
importjava.util.Map;
7
8
importjava.util.function.IntFunction;
8
9
9
10
importorg.jspecify.annotations.NonNull;
@@ -30,7 +31,7 @@ public DefaultVariableReferenceGraph(VariableReferenceGraphBuilder<Solution_> ou
30
31
}
31
32
}
32
33
// Immutable optimized version of the map, now that it won't be updated anymore.
0 commit comments