<div dir="ltr"><div><div>I'm starting to contribute and Timothy Arceri told me about this<br>task. The change was made at that sole file because we talked<br>about no need to migrate all tables at once, but we discuss this<br>and I take note to migrate all hash tables at once if everyone<br></div>agrees.<br><br></div>PS.: I forgot to add Reviewed-by Timothy Arceri at the commit<br>message. If we are ok with migrating in steps, I'll edit it and send<br>the patch again.</div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-03 2:40 GMT+02:00 Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Oh, fair enough then.</p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Aug 3, 2015 12:39 PM, "Ilia Mirkin" <<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Given that this is a debug-only thing, I doubt perf numbers are that<br>
interesting.<br>
<br>
I have no clue what the diff is between the two hash tables, but if<br>
one is allegedly faster than the other, that should be determined, and<br>
we should just mass-migrate...<br>
<br>
  -ilia<br>
<br>
On Sun, Aug 2, 2015 at 8:05 PM, Chris Forbes <<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>> wrote:<br>
> Some perf numbers would be nice. How much is this winning?<br>
><br>
> - Chris<br>
><br>
> On Mon, Aug 3, 2015 at 11:18 AM, Timothy Arceri <<a href="mailto:t_arceri@yahoo.com.au" target="_blank">t_arceri@yahoo.com.au</a>> wrote:<br>
>> On Sun, 2015-08-02 at 19:50 +0200, Alejandro Seguí wrote:<br>
>><br>
>> Maybe just for completeness you could add this to the commit message<br>
>><br>
>> The util/hash_table was intended to be a fast hash table<br>
>> replacement for the program/hash_table see 35fd61bd99c1 and 72e55bb6888ff.<br>
>><br>
>>> ---<br>
>>>  src/glsl/ir_print_visitor.cpp | 19 ++++++++++++-------<br>
>>>  1 file changed, 12 insertions(+), 7 deletions(-)<br>
>>><br>
>>> diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp<br>
>>> index 78475f3..641a996 100644<br>
>>> --- a/src/glsl/ir_print_visitor.cpp<br>
>>> +++ b/src/glsl/ir_print_visitor.cpp<br>
>>> @@ -25,7 +25,7 @@<br>
>>>  #include "glsl_types.h"<br>
>>>  #include "glsl_parser_extras.h"<br>
>>>  #include "main/macros.h"<br>
>>> -#include "program/hash_table.h"<br>
>>> +#include "util/hash_table.h"<br>
>>><br>
>>>  static void print_type(FILE *f, const glsl_type *t);<br>
>>><br>
>>> @@ -89,14 +89,14 @@ ir_print_visitor::ir_print_visitor(FILE *f)<br>
>>>  {<br>
>>>     indentation = 0;<br>
>>>     printable_names =<br>
>>> -      hash_table_ctor(32, hash_table_pointer_hash,<br>
>>> hash_table_pointer_compare);<br>
>>> +      _mesa_hash_table_create(NULL, _mesa_hash_pointer,<br>
>>> _mesa_key_pointer_equal);<br>
>>>     symbols = _mesa_symbol_table_ctor();<br>
>>>     mem_ctx = ralloc_context(NULL);<br>
>>>  }<br>
>>><br>
>>>  ir_print_visitor::~ir_print_visitor()<br>
>>>  {<br>
>>> -   hash_table_dtor(printable_names);<br>
>>> +   _mesa_hash_table_destroy(printable_names, NULL);<br>
>>>     _mesa_symbol_table_dtor(symbols);<br>
>>>     ralloc_free(mem_ctx);<br>
>>>  }<br>
>>> @@ -121,9 +121,14 @@ ir_print_visitor::unique_name(ir_variable *var)<br>
>>>     }<br>
>>><br>
>>>     /* Do we already have a name for this variable? */<br>
>>> -   const char *name = (const char *) hash_table_find(this->printable_names,<br>
>>> var);<br>
>>> -   if (name != NULL)<br>
>>> -      return name;<br>
>>> +   struct hash_entry * entry =<br>
>>> +        _mesa_hash_table_search(this->printable_names, var);<br>
>>> +<br>
>>> +   if (entry != NULL) {<br>
>>> +      return (const char *) entry->data;<br>
>>> +   }<br>
>>> +<br>
>>> +   const char* name = NULL;<br>
>><br>
>> The above looks a bit funny just floating here maybe move it<br>
>><br>
>>><br>
>>>     /* If there's no conflict, just use the original name */<br>
>> Here.<br>
>>>     if (_mesa_symbol_table_find_symbol(this->symbols, -1, var->name) ==<br>
>>> NULL) {<br>
>>> @@ -132,7 +137,7 @@ ir_print_visitor::unique_name(ir_variable *var)<br>
>>>        static unsigned i = 1;<br>
>>>        name = ralloc_asprintf(this->mem_ctx, "%s@%u", var->name, ++i);<br>
>>>     }<br>
>>> -   hash_table_insert(this->printable_names, (void *) name, var);<br>
>>> +   _mesa_hash_table_insert(this->printable_names, var, (void *) name);<br>
>>>     _mesa_symbol_table_add_symbol(this->symbols, -1, name, var);<br>
>>>     return name;<br>
>>>  }<br>
>><br>
>> With those couple of small changes you can add to the commit message<br>
>> Reviewed-by: Timothy Arceri <<a href="mailto:t_arceri@yahoo.com.au" target="_blank">t_arceri@yahoo.com.au</a>><br>
>><br>
>> _______________________________________________<br>
>> mesa-dev mailing list<br>
>> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
>> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>
</div></div></blockquote></div><br></div>