-
-
Save littleq0903/7244173 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
try: | |
from cStringIO import StringIO | |
except: | |
from io import StringIO | |
from datetime import datetime | |
def test_join(): | |
data = [] | |
for i in range(1000000): | |
data.append(str(i)) | |
data = "".join(data) | |
def test_connect(): | |
data = "" | |
for i in range(1000000): | |
data += str(i) | |
def test_stringio(): | |
data = StringIO() | |
for i in range(1000000): | |
data.write(str(i)) | |
now = datetime.now() | |
test_join() | |
now2 = datetime.now() | |
test_connect() | |
now3 = datetime.now() | |
test_stringio() | |
now4 = datetime.now() | |
print('test_join') | |
print(now2 - now) | |
print('test_connect') | |
print(now3 - now2) | |
print('test_stringio') | |
print(now4 - now3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment