Skip to content

Instantly share code, notes, and snippets.

@kjelly
Created November 16, 2013 06:46
Show Gist options
  • Save kjelly/7496787 to your computer and use it in GitHub Desktop.
Save kjelly/7496787 to your computer and use it in GitHub Desktop.
觀察與實驗
a='''
def test_join():
data = []
for i in range(1000000):
data.append('addddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeewweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffeeeeeeeeeeeeeeeeeeeeeeeeeerwerwerwerwetrwegfsghklujsahdflkiuahfgluhewihrlwelfhlwuhfawhrgfiuhagrliwrwreqwerqwerwefsdfasdfasdfasdfdsfddddddddddddddddeeeeeeeewwwwwwwwwwwwwddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd')
return ''.join(data)
test_join()
'''
b = '''
def test_connect():
data = ""
for i in range(1000000):
data += 'addddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeewweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffeeeeeeeeeeeeeeeeeeeeeeeeeerwerwerwerwetrwegfsghklujsahdflkiuahfgluhewihrlwelfhlwuhfawhrgfiuhagrliwrwreqwerqwerwefsdfasdfasdfasdfdsfddddddddddddddddeeeeeeeewwwwwwwwwwwwwddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
return data
test_connect()
'''
import timeit
print timeit.timeit(a, number=10)
print timeit.timeit(b, number=10)
@ccc-larc
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment