Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- def test0(n):
- for i in range(n):
- line = bytearray()
- line.extend(('1','2','3'))
- def test1(n):
- for i in range(n):
- line = '{0}{1}{2}'.format('1','2','3')
- def test2(n):
- for i in range(n):
- line = '%s%s%s'%('1','2','3')
- def test3(n):
- for i in range(n):
- line = ''.join(('1','2','3'))
- def test4(n):
- for i in range(n):
- line = '1'+'2'+'3'
- if __name__ == '__main__':
- a =[test0, test1, test2, test3, test4]
- for m in a:
- s = time.time()
- m(100000)
- e = time.time()
- print(e-s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement