This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
| How expensive is the hash function? Unless it's pretty extreme, I'd | be surprised if you needed to get all the way to 10 to get a win.
Actually, we have the hash function for free for the following reason:
by caching the hash value, as suggested in a previous patch, we don't need to recompute it when we map a name to the associated type. That hash is already computed as a result of calling get_identifier().
If the hash function is free, then it's hard to imagine that a hash table would ever be substantially more expensive than a list. The costs of a hash table are one mod or the moral equivalent (to get from the hash function to a bucket index) and one extra pointer indirection (to get to the head of the bucket). How many linked list nodes to you have to chase through to make up for a single integer division? Not very many, I'd think.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |