[BasicContainers] Make _HTable nonfrozen and most of its operations noninlinable

This is a nongeneric type, so it makes sense to see if Swift has matured enough to use opaque/resilient types in high-performance contexts. It would be ideal if the core hash table implementation would remain flexible.

We may need to sprinkle some effect attributes over these.
This commit is contained in:
Karoy Lorentey committed 2026-02-19 17:56:22 -08:00
1 parent 0cf34cc3a9
commit a1902c30aa
7 files changed
+40 -64

No files matched your search

@@ -191,15 +191,13 @@ extension _HTable {
extension _HTable {
@_transparent
@inlinable
package func idealBucket(forHashValue hashValue: Int) -> Bucket {
internal func idealBucket(forHashValue hashValue: Int) -> Bucket {
let hashValue = UInt(truncatingIfNeeded: hashValue)
return Bucket(offset: hashValue & (bucketCount &- 1))
}
@_transparent
@inlinable
package func probeLength(
internal func probeLength(
from start: Bucket,
to end: Bucket
) -> Int {
@@ -210,8 +208,7 @@ extension _HTable {
}
@_transparent
@inlinable
package func probeLength(
internal func probeLength(
forHashValue hashValue: Int,
in bucket: Bucket
) -> Int {
@@ -221,11 +218,12 @@ extension _HTable {
}
extension _HTable {
@inlinable
@usableFromInline
package mutating func clear() {
self._count = 0
self.bitmap.clearAll()
self._totalProbeLength = 0
self._maxProbeLength = 0
}
}
#endif