Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 5c8e3d19bc7b6179e80c448344941b06893b685f 1 parent 979b7df
makoto kuwata authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 others/string-concat/python/bench_strcat.py
17 others/string-concat/python/bench_strcat.py
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.