-
Bug
-
Resolution: Unresolved
-
P4
-
repo-valhalla
-
generic
-
generic
LIFE (Legacy Idiom For Equality) is an optimization that makes a reference equality check before the "equals" method invocation to speed up the equality check.
Like it's implemented in the Objects.equals method:
public static boolean equals(Object a, Object b) {
return (a == b) || (a != null && a.equals(b));
}
In Valhalla, such equality optimization causes performance regression. Reference check on value classes (and/or migrated classes) is expensive and really unnecessary.
1. SPECjbb2005 has -7% regressions.
The source: equality check for j.l.Integer inside j.u.HashMap.
2. A simple microbenchmark like:
@Benchmark
public OffsetDateTime odt_now() {
return OffsetDateTime.now();
}
has -30% performance regression.
The source: ConcurrentMap<Integer, ZoneOffsetTransition[]> lastRulesCache
Like it's implemented in the Objects.equals method:
public static boolean equals(Object a, Object b) {
return (a == b) || (a != null && a.equals(b));
}
In Valhalla, such equality optimization causes performance regression. Reference check on value classes (and/or migrated classes) is expensive and really unnecessary.
1. SPECjbb2005 has -7% regressions.
The source: equality check for j.l.Integer inside j.u.HashMap.
2. A simple microbenchmark like:
@Benchmark
public OffsetDateTime odt_now() {
return OffsetDateTime.now();
}
has -30% performance regression.
The source: ConcurrentMap<Integer, ZoneOffsetTransition[]> lastRulesCache
- relates to
-
JDK-8366214 [lworld] Use Objects.equals in HashMap and ConcurrentHashmap
-
- Open
-
-
JDK-8255024 [lworld] Split acmp forward through virtual calls to Object.equals
-
- Open
-