summaryrefslogtreecommitdiff
path: root/coverage/templite.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-02-07 15:46:47 -0500
committerNed Batchelder <ned@nedbatchelder.com>2010-02-07 15:46:47 -0500
commitb79c9052164851e90603be595eddcbda25f7aadc (patch)
treede6064cb8dfbc478949a4f0d829f0315c98fc633 /coverage/templite.py
parent34e4e761dc95906a8f7be32e84d3f70e46c436ea (diff)
downloadpython-coveragepy-b79c9052164851e90603be595eddcbda25f7aadc.tar.gz
You know that thing they say about how ''.join(slist) is faster than s1 += s? It's really true. This one change removed 90% of the templite time, and 59% of the html report generation time.
Diffstat (limited to 'coverage/templite.py')
-rw-r--r--coverage/templite.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/coverage/templite.py b/coverage/templite.py
index d3c673c..66f38a9 100644
--- a/coverage/templite.py
+++ b/coverage/templite.py
@@ -101,14 +101,14 @@ class Templite(object):
# Run it through an engine, and return the result.
engine = _TempliteEngine(ctx)
engine.execute(self.ops)
- return engine.result
+ return "".join(engine.result)
class _TempliteEngine(object):
"""Executes Templite objects to produce strings."""
def __init__(self, context):
self.context = context
- self.result = ""
+ self.result = []
def execute(self, ops):
"""Execute `ops` in the engine.