[Mesa-dev] [PATCH 3/5] mesa: Import a copy of the open-addressing hash table code I wrote.

Eric Anholt eric at anholt.net
Tue Nov 6 11:35:47 PST 2012


Brian Paul <brianp at vmware.com> writes:
> On 10/25/2012 10:13 AM, Eric Anholt wrote:
>> +struct hash_entry *
>> +_mesa_hash_table_random_entry(struct hash_table *ht,
>> +                              bool (*predicate)(struct hash_entry *entry))
>
> Just curious, what is this function used for?  Just testing?

We have some really stupid behavior some of our caches where when we get
more than n thousand entries, we flush the whole cache and start again.
If you have a function that lets you easily pick a random entry, you can
provide more consistent performance once the app's working set is larger
than the cache size.

I was using this with this hash table in the i965 driver's program cache
at one point, though our new program cache setup makes this harder.

>> diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
>> index d51adf5..13ba16a 100644
>> --- a/src/mesa/sources.mak
>> +++ b/src/mesa/sources.mak
>> @@ -249,6 +249,7 @@ STATETRACKER_FILES = \
>>   PROGRAM_FILES = \
>>   	$(SRCDIR)program/arbprogparse.c \
>>   	$(SRCDIR)program/chaining_hash_table.c \
>> +	$(SRCDIR)program/hash_table.c \
>>   	$(SRCDIR)program/program.c \
>>   	$(SRCDIR)program/program_parse_extra.c \
>>   	$(SRCDIR)program/prog_cache.c \
>
> Update the SConscript file too?

Done (and the const change).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121106/0e5477d4/attachment.pgp>


More information about the mesa-dev mailing list