mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
Slightly more efficient rehash size selection
While probably still not optimal in terms of everyday usage in pacman, this reduces the absolute size increase to "more reasonable" levels. For databases greater than 5000 in size, the minimum size increase is used which is still on the order of a 10% increase. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
d843c86b7b
commit
c9820ec97b
@ -98,10 +98,12 @@ static pmpkghash_t *rehash(pmpkghash_t *oldhash)
|
||||
* require a table size increase that large. */
|
||||
if(oldhash->buckets < 500) {
|
||||
newsize = oldhash->buckets * 2;
|
||||
} else if(oldhash->buckets < 3500) {
|
||||
} else if(oldhash->buckets < 2000) {
|
||||
newsize = oldhash->buckets * 3 / 2;
|
||||
} else {
|
||||
} else if(oldhash->buckets < 5000) {
|
||||
newsize = oldhash->buckets * 4 / 3;
|
||||
} else {
|
||||
newsize = oldhash->buckets + 1;
|
||||
}
|
||||
|
||||
newhash = _alpm_pkghash_create(newsize);
|
||||
|
Loading…
Reference in New Issue
Block a user