Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1229

C client hashtable_remove redundantly calls hash function

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 3.3.3
    • 3.5.0
    • c client
    • Reviewed

    Description

      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.

      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;
      

      Attachments

        1. ZOOKEEPER-1229.patch
          0.5 kB
          Harsh J

        Activity

          People

            qwertymaniac Harsh J
            spackler Eric Abbott
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: