Skip to content

Commit

Permalink
simplify cache generation
Browse files Browse the repository at this point in the history
don't use lambda to filter. this is 25% faster but really negligible.

Change-Id: Ib76470fc3a5cdfc79e497d568147b66c08e6dba1
  • Loading branch information
chungg authored and dchavoll committed Aug 15, 2018
1 parent 886dc38 commit 992efae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ceilometer/publisher/gnocchi.py
Expand Up @@ -462,8 +462,8 @@ def _if_not_cached(self, operation, resource_type, resource, method,

def _check_resource_cache(self, key, resource_data):
cached_hash = self.cache.get(key)
attribute_hash = hash(frozenset(filter(lambda x: x[0] != "metrics",
resource_data.items())))
attribute_hash = hash(tuple(i for i in resource_data.items()
if i[0] != 'metrics'))
if not cached_hash or cached_hash != attribute_hash:
return attribute_hash
else:
Expand Down

0 comments on commit 992efae

Please sign in to comment.