- uint32_t hash = hashlittle(S, Size, 0xdeadbeef);
-
- /* We use a VERY LARGE INTRANSIENT hash table here, this speeds up generation
- by AN INSANE amount on ALL machines */
- pkgCache::StringItem **Bucket2;
- while (true) {
- Bucket2 = &UniqHash[hash % _count(UniqHash)];
- if (*Bucket2 == NULL)
- break;
- if (stringcmp(S,S+Size,Cache.StrP + (*Bucket2)->String) == 0)
- return (*Bucket2)->String;
- hash += 7;
- }
+ /* We use a very small transient hash table here, this speeds up generation
+ by a fair amount on slower machines */
+ pkgCache::StringItem *&Bucket = UniqHash[(S[0]*5 + S[1]) % _count(UniqHash)];
+ if (Bucket != 0 &&
+ stringcmp(S,S+Size,Cache.StrP + Bucket->String) == 0)
+ return Bucket->String;