Closed GoogleCodeExporter closed 9 years ago
This is a tough issue, and one I struggled with when making the pointer
optimization. In the common case, dense_hash_set<char*> is hashing different
char*'s allocated separately. In that case, dividing by sizeof(void*) is the
right thing to do and will speed things up.
In the case where you are hashing into the same string, as in your example,
then dividing by sizeof(void*) will do the wrong thing, and slow things down.
Did you have a real case where this is happening, that this bit you? I don't
expect to see these problems very often (if at all) in practice, but my
expectations could be mistaken.
Original comment by csilv...@gmail.com
on 26 Jan 2012 at 1:31
No real case, just an observation.
It's not about char only, also short* and int* (on 64 bit).
Not a big issue, of course. It's up to you. Thanks.
Original comment by bulovya...@gmail.com
on 26 Jan 2012 at 9:26
OK, good to know. I'm going to close the bug for now, but if people start
seeing this in real applications, it would be good to reopen at that time.
Original comment by csilv...@gmail.com
on 26 Jan 2012 at 7:50
Original issue reported on code.google.com by
bulovya...@gmail.com
on 20 Jan 2012 at 11:54