diff --git a/src/util/hash_table.c b/src/util/hash_table.c index 25b16cd3f31..58a0bf2e2e2 100644 --- a/src/util/hash_table.c +++ b/src/util/hash_table.c @@ -88,9 +88,24 @@ static const struct { { max_entries, size, rehash, \ REMAINDER_MAGIC(size), REMAINDER_MAGIC(rehash) } + /* Starting with only 2 entries at initialization causes a lot of table + * reallocations and rehashing while growing the table. + * + * Below are results from counting reallocations when compiling + * my GLSL shader-db on radeonsi+ACO. + * + * 2 entries is the baseline. + * Starting with 4 entries reduces reallocations to 70%. + * Starting with 8 entries reduces reallocations to 48%. + * Starting with 16 entries reduces reallocations to 33%. + * Starting with 32 entries reduces reallocations to 21%. + * Starting with 64 entries reduces reallocations to 13%. + */ +#if 0 /* Start with 16 entries. */ ENTRY(2, 5, 3 ), ENTRY(4, 7, 5 ), ENTRY(8, 13, 11 ), +#endif ENTRY(16, 19, 17 ), ENTRY(32, 43, 41 ), ENTRY(64, 73, 71 ),