mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 07:20:10 +01:00
util/hash_table: start with 16 entries to reduce reallocations
Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
This commit is contained in:
parent
06cef7bcc2
commit
be5a15f11d
1 changed files with 15 additions and 0 deletions
|
|
@ -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 ),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue