stasis: Reduce calculation of stasis message type hash.

When the stasis cache is used a hash is calculated for
retrieving or inserting messages. This change calculates
a hash when the message type is initialized that is then
used each time needed. This ensures that the hash is
calculated only once for the message type.

Change-Id: I4fe6bfdafb55bf5c322dd313fbd8c32cce73ef37
This commit is contained in:
Joshua Colp
2018-08-06 08:36:22 -03:00
parent db765cea68
commit 455ca1095e
3 changed files with 17 additions and 1 deletions

View File

@@ -174,7 +174,7 @@ static void cache_entry_dtor(void *obj)
static void cache_entry_compute_hash(struct cache_entry_key *key)
{
key->hash = ast_hashtab_hash_string(stasis_message_type_name(key->type));
key->hash = stasis_message_type_hash(key->type);
key->hash += ast_hashtab_hash_string(key->id);
}