Created
November 16, 2013 06:46
-
-
Save kjelly/7496787 to your computer and use it in GitHub Desktop.
觀察與實驗
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
幫你簡化一下 XD
https://gist.github.com/ccc-larc/7717083