Overview
Comment: | Make sure the fullness of a hashtable is always at max 3/4.
Before, this was only ensured if you mutated the dictionary at least |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
1bec445dd21572d79ee75240f53ea039 |
User & Date: | js on 2011-10-24 15:47:18 |
Other Links: | manifest | tags |
Context
2011-10-24
| ||
18:28 | Don't retain delegates to prevent reference cycles. check-in: 87cd99ff88 user: js tags: trunk | |
15:47 | Make sure the fullness of a hashtable is always at max 3/4. check-in: 1bec445dd2 user: js tags: trunk | |
15:00 | Don't use a spinlock for reference counting if we have no threads. check-in: 9454c38313 user: js tags: trunk | |
Changes
Modified src/OFDictionary_hashtable.m from [e193cfb1d7] to [86b064ec63].
︙ | ︙ | |||
131 132 133 134 135 136 137 138 139 140 141 142 143 144 | count = [dictionary count]; if (count > UINT32_MAX) @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (newSize == 0) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; | > > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | count = [dictionary count]; if (count > UINT32_MAX) @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (count * 4 / newSize >= 3) newSize <<= 1; if (newSize == 0) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; |
︙ | ︙ | |||
243 244 245 246 247 248 249 250 251 252 253 254 255 256 | objectsCArray = [objects cArray]; count = [keys count]; if (count > UINT32_MAX) @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (newSize == 0) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; | > > | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | objectsCArray = [objects cArray]; count = [keys count]; if (count > UINT32_MAX) @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (count * 4 / newSize >= 3) newSize <<= 1; if (newSize == 0) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; |
︙ | ︙ | |||
363 364 365 366 367 368 369 370 371 372 373 374 375 376 | for (; va_arg(argumentsCopy, id) != nil; count++); count >>= 1; if (count > UINT32_MAX) @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (newSize == 0) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; | > > | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | for (; va_arg(argumentsCopy, id) != nil; count++); count >>= 1; if (count > UINT32_MAX) @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (count * 4 / newSize >= 3) newSize <<= 1; if (newSize == 0) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; |
︙ | ︙ |