Permalink
Browse files

string-concat: python: add 'extend() only (no join)' entry

  • Loading branch information...
1 parent 979b7df commit 5c8e3d19bc7b6179e80c448344941b06893b685f @kwatch committed Aug 21, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 others/string-concat/python/bench_strcat.py
@@ -116,6 +116,23 @@ def verify(out):
verify(out)
+ with bm("extend() only (no join)"):
+ for i in xrange(loop):
+ buf = []; extend = buf.extend
+ extend(('''<table>\n''',))
+ for j in xrange(20):
+ extend((''' <tr>
+ <td>''', s1, '''</td>
+ <td>''', s2, '''</td>
+ <td>''', s3, '''</td>
+ <td>''', s4, '''</td>
+ <td>''', s5, '''</td>
+ </tr>\n''',))
+ extend(('''</table>\n''',))
+ #out = "".join(buf)
+ #verify(out)
+
+
with bm("extend()+str()"):
for i in xrange(loop):
buf = []; extend = buf.extend

0 comments on commit 5c8e3d1

Please sign in to comment.