There is no need to generate a hash key *if* the hash_alloc_function
is NULL and the hash is empty.
This changed showed a measurable increase in performance for
table hash lookup for tables that were meant to be empty in
bgp( the distance commands ).
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
void *newdata;
struct hash_backet *backet;
+ if (!alloc_func && !hash->count)
+ return NULL;
+
key = (*hash->hash_key)(data);
index = key & (hash->size - 1);