Differences From Artifact [0307a15aa9]:
- File src/OFObject.m — part of check-in [31d023e401] at 2012-12-06 21:17:55 on branch trunk — Fix Clang warnings and a typo. (user: js, size: 26283) [annotate] [blame] [check-ins using]
To Artifact [ce3e8ba58d]:
- File
src/OFObject.m
— part of check-in
[6712442fad]
at
2012-12-07 13:57:13
on branch trunk
— Revert several OFHashMap related commits.
This reverts:
* "Add a per-hashtable seed."
(cd49c7fcb4b8dca62dccdbf6545d37d86b639eef)
* "OFMapTable: Reseed on resize."
(5b545165691cd9ad838c9125b02ff7c857bd4b99)
* "Add of_random()."
(9810f191b4e8c1612e7e55095c87e589660fbdba)
* "OFMapTable: Rotate hash by a random number of bits"
(3bef412217232d01f202794f7175c130afa1df8f)It turned out that these were slowing down all classes based on
OFHashMap significantly. As there is still no proof that the seeded
one-at-a-time hash is vulnerable to DoS, these changes were overly
paranoid. While overly paranoid is usually ok, it is not if it severely
impacts performance. (user: js, size: 26100) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
225 226 227 228 229 230 231 | if OF_UNLIKELY (extra != NULL) *extra = (char*)instance + instanceSize + extraAlignment; return instance; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | if OF_UNLIKELY (extra != NULL) *extra = (char*)instance + instanceSize + extraAlignment; return instance; } const char* _NSPrintForDebugger(id object) { return [[object description] cStringWithEncoding: OF_STRING_ENCODING_NATIVE]; } |
︙ | ︙ | |||
307 308 309 310 311 312 313 | of_pagesize = 4096; # ifdef _SC_NPROCESSORS_CONF if ((of_num_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 1) # endif of_num_cpus = 1; #endif | > | > > > > > > > > > > > | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | of_pagesize = 4096; # ifdef _SC_NPROCESSORS_CONF if ((of_num_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 1) # endif of_num_cpus = 1; #endif #if defined(OF_HAVE_ARC4RANDOM) of_hash_seed = arc4random(); #elif defined(OF_HAVE_RANDOM) struct timeval t; gettimeofday(&t, NULL); srandom((unsigned)(t.tv_sec ^ t.tv_usec)); of_hash_seed = (uint32_t)((random() << 16) | (random() & 0xFFFF)); #else struct timeval t; gettimeofday(&t, NULL); srand((unsigned)(t.tv_sec ^ t.tv_usec)); of_hash_seed = (uint32_t)((rand() << 16) | (rand() & 0xFFFF)); #endif } + (void)initialize { } + alloc |
︙ | ︙ |