C client hashtable_remove redundantly calls hash function
---------------------------------------------------------

                 Key: ZOOKEEPER-1229
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1229
             Project: ZooKeeper
          Issue Type: Improvement
          Components: c client
    Affects Versions: 3.3.3
            Reporter: Eric Abbott
            Priority: Trivial


hashtable_remove appears to call the hash function in consecutive lines. As 
hash functions are generally cpu intensive, using the hashvalue returned from 
the first call will result in a performance improvement.

{noformat}
void * /* returns value associated with key */
hashtable_remove(struct hashtable *h, void *k)
...
    unsigned int hashvalue, index;

    hashvalue = hash(h,k);
    index = indexFor(h->tablelength,hash(h,k));
    pE = &(h->table[index]);
    e = *pE;
{noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to