Improve a bit performance of Ceilometer

we shouldn't use <array>.extend([<generator>]) it's similiar to
<array>.extend(<generator>) but slower

Change-Id: Ic859e9a477f03b680e1ac0db1498261a3dc24997
This commit is contained in:
Boris Pavlovic 2014-06-30 22:11:25 +04:00
parent 09720bf524
commit 89b325c3e9
4 changed files with 9 additions and 9 deletions

View File

@ -130,8 +130,8 @@ class AnalyticsAPIBaseClient(object):
dump.append('HTTP %.1f %s %s\n' % (resp.raw.version, dump.append('HTTP %.1f %s %s\n' % (resp.raw.version,
resp.status_code, resp.status_code,
resp.reason)) resp.reason))
dump.extend(['%s: %s\n' % (k, v) dump.extend('%s: %s\n' % (k, v)
for k, v in six.iteritems(resp.headers)]) for k, v in six.iteritems(resp.headers))
dump.append('\n') dump.append('\n')
if resp.content: if resp.content:
dump.extend([resp.content, '\n']) dump.extend([resp.content, '\n'])

View File

@ -213,8 +213,8 @@ class Client():
dump.append('HTTP %.1f %s %s\n' % (resp.raw.version, dump.append('HTTP %.1f %s %s\n' % (resp.raw.version,
resp.status_code, resp.status_code,
resp.reason)) resp.reason))
dump.extend(['%s: %s\n' % (k, v) dump.extend('%s: %s\n' % (k, v)
for k, v in six.iteritems(resp.headers)]) for k, v in six.iteritems(resp.headers))
dump.append('\n') dump.append('\n')
if resp.content: if resp.content:
dump.extend([resp.content, '\n']) dump.extend([resp.content, '\n'])

View File

@ -67,9 +67,9 @@ class NotificationBase(PluginBase):
targets = [] targets = []
for exchange, topics in self.get_exchange_topics(conf): for exchange, topics in self.get_exchange_topics(conf):
targets.extend([oslo.messaging.Target(topic=topic, targets.extend(oslo.messaging.Target(topic=topic,
exchange=exchange) exchange=exchange)
for topic in topics]) for topic in topics)
return targets return targets
@abc.abstractmethod @abc.abstractmethod

View File

@ -200,9 +200,9 @@ def get_meter_columns(metaquery, **kwargs):
column name in db column name in db
""" """
columns = ['f:message', 'f:recorded_at'] columns = ['f:message', 'f:recorded_at']
columns.extend(["f:%s" % k for k, v in kwargs.items() if v]) columns.extend("f:%s" % k for k, v in kwargs.items() if v)
if metaquery: if metaquery:
columns.extend(["f:r_%s" % k for k, v in metaquery.items() if v]) columns.extend("f:r_%s" % k for k, v in metaquery.items() if v)
return columns return columns