Fix performance regression in NI by fixing totally incorrect hashCode
The actual problem was introduced in4f1e85b468, note how `hashCode` is implemented: ``` var currentHashCode = cachedHashCode if (currentHashCode == 0) return currentHashCode ... ``` It's a silly bug, there should be check `if (currentHashCode != 0) ...` because `0` is used a marker for "uncomputed value". Now, in the commit0219b86d06I added map with `KotlinType` as a key and because of constant `hash` for `KotlinType`, we basically got `List` instead of `Map`, which caused this performance regression #KT-34063 Fixed
This commit is contained in:
@@ -101,7 +101,7 @@ sealed class KotlinType : Annotated, KotlinTypeMarker {
|
||||
final override fun hashCode(): Int {
|
||||
// NB: make one read to prevent race
|
||||
var currentHashCode = cachedHashCode
|
||||
if (currentHashCode == 0) return currentHashCode
|
||||
if (currentHashCode != 0) return currentHashCode
|
||||
|
||||
currentHashCode = computeHashCode()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user