diff --git a/stdlib/public/core/HashedCollections.swift.gyb b/stdlib/public/core/HashedCollections.swift.gyb index 407d0e250e584..723d712bc05e9 100644 --- a/stdlib/public/core/HashedCollections.swift.gyb +++ b/stdlib/public/core/HashedCollections.swift.gyb @@ -678,8 +678,10 @@ public func == (lhs: Set, rhs: Set) -> Boo case (.Native(let lhsNativeOwner), .Native(let rhsNativeOwner)): let lhsNative = lhsNativeOwner.nativeStorage let rhsNative = rhsNativeOwner.nativeStorage - // FIXME(performance): early exit if lhs and rhs reference the same - // storage? + + if lhsNativeOwner === rhsNativeOwner { + return true + } if lhsNative.count != rhsNative.count { return false @@ -1184,8 +1186,10 @@ public func == ( case (.Native(let lhsNativeOwner), .Native(let rhsNativeOwner)): let lhsNative = lhsNativeOwner.nativeStorage let rhsNative = rhsNativeOwner.nativeStorage - // FIXME(performance): early exit if lhs and rhs reference the same - // storage? + + if lhsNativeOwner === rhsNativeOwner { + return true + } if lhsNative.count != rhsNative.count { return false