zokis / Python--Faster-Way

Python: Faster Way
http://pythonfasterway.cf/
232 stars 29 forks source link

Test 10 String concatenation even faster method #4

Closed holg closed 9 years ago

holg commented 9 years ago

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

holg commented 9 years ago

i was mistaken to name the test files to the presumed result