Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Arne Goedeke
I think the hash lookup should not modify the hash list. Its quite expensive to relink it on every lookup and definitely negates any intended speedup. Interestingly, that code seems to go back all the way to the first pike commit from ulpc. Arne On Fri, 30 May 2014, Chris Angelico wrote: gcc

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
Benchmarks! But yeah, for the optimization to be meaningful there should be at least be a shortpath for the case where the element is already at the head (which does not move it).

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Chris Angelico
On Sat, May 31, 2014 at 1:08 AM, Arne Goedeke e...@laramies.com wrote: I think the hash lookup should not modify the hash list. Its quite expensive to relink it on every lookup and definitely negates any intended speedup. Interestingly, that code seems to go back all the way to the first pike

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Arne Goedeke
Its only being used in define lookups in the cpp. It makes cpp() about 10% slower on a file that only contains #define and #if defined() statements. arne On Fri, 30 May 2014, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote: Benchmarks! But yeah, for the

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Arne Goedeke
Your patch is correct, the pointer cannot be const, as *prev and *base are modified, which are offsets of h-htable, which is 'const struct hash_entry *'. arne On Sat, 31 May 2014, Chris Angelico wrote: On Sat, May 31, 2014 at 1:08 AM, Arne Goedeke e...@laramies.com wrote: I think the hash

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Stephen R. van den Berg
Chris Angelico wrote: So the question is, what does a 'const struct hash_table *' imply? Is Strictly speaking it only says that the direct struct hash_table element this pointer is pointing at will not be modified in any way. If the struct contains other pointers, the things these pointers point

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Chris Angelico
On Sat, May 31, 2014 at 2:59 AM, Stephen R. van den Berg s...@cuci.nl wrote: Chris Angelico wrote: So the question is, what does a 'const struct hash_table *' imply? Is Strictly speaking it only says that the direct struct hash_table element this pointer is pointing at will not be modified in

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Stephen R. van den Berg
Chris Angelico wrote: On Sat, May 31, 2014 at 2:59 AM, Stephen R. van den Berg s...@cuci.nl wrote: Strictly speaking it only says that the direct struct hash_table element this pointer is pointing at will not be modified in any way. If the struct contains other pointers, the things these

Re: [PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-30 Thread Chris Angelico
On Sat, May 31, 2014 at 5:46 AM, Stephen R. van den Berg s...@cuci.nl wrote: Chris Angelico wrote: On Sat, May 31, 2014 at 2:59 AM, Stephen R. van den Berg s...@cuci.nl wrote: Strictly speaking it only says that the direct struct hash_table element this pointer is pointing at will not be

[PATCH] De-constify hashtable lookup to prevent compiler warning

2014-05-29 Thread Chris Angelico
gcc on Linux is warning of an assignment that removes 'const', in a situation where the function's argument is const and the function then mutates via a local pointer. Removing 'const' from the argument silences the warning and makes it clear that the argument may be changed; or if that's not