added even faster string concatenation test:test10/t1.py, incrementing older t1, t2 to t2, t3
following b(): (just for test purpose, it is also named a() in code
is much faster than the old t1.py, so i incremented the old tn.py and added new t1.py as being the fastest:
def b():
r=''
for i in range(10):
r='%s%d' %(r,i)
return r
In [27]: timeit(a, number=1000000)
Out[27]: 3.4888150691986084
In [28]: timeit(b, number=1000000)
Out[28]: 2.244536876678467
added even faster string concatenation test:test10/t1.py, incrementing older t1, t2 to t2, t3 following b(): (just for test purpose, it is also named a() in code is much faster than the old t1.py, so i incremented the old tn.py and added new t1.py as being the fastest:
def b(): r='' for i in range(10): r='%s%d' %(r,i) return r
In [27]: timeit(a, number=1000000) Out[27]: 3.4888150691986084
In [28]: timeit(b, number=1000000) Out[28]: 2.244536876678467