Skip to content

Commit 3b9d453

Browse files
committed
[stdlib] _HashTable: Rewrite applying some SIMD(ish) tricks
- Reduce the number of hash table buckets by a factor of 8. - Increase the size of buckets from 1 to 8 entries. - Use SIMD within a register to find matching entries, instead of iterating over individual bytes.
1 parent e00f11f commit 3b9d453

File tree

5 files changed

+829
-532
lines changed

5 files changed

+829
-532
lines changed

stdlib/public/SwiftShims/GlobalObjects.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ struct _SwiftUnsafeBitMap {
4545
__swift_intptr_t bitCount;
4646
};
4747

48-
struct _SwiftHashTable {
49-
__swift_intptr_t count;
50-
__swift_intptr_t capacity;
51-
__swift_intptr_t bucketCount;
52-
void *map;
53-
};
54-
5548
struct _SwiftDictionaryBodyStorage {
5649
__swift_intptr_t capacity;
5750
__swift_intptr_t count;
@@ -61,7 +54,9 @@ struct _SwiftDictionaryBodyStorage {
6154
};
6255

6356
struct _SwiftSetBodyStorage {
64-
struct _SwiftHashTable hashTable;
57+
__swift_uint64_t count;
58+
__swift_uint64_t capacity;
59+
__swift_uint64_t scale;
6560
__swift_uint64_t seed0;
6661
__swift_uint64_t seed1;
6762
void *rawElements;

0 commit comments

Comments
 (0)