파이썬 입출력 속도 비교.
입력속도
1 |
PyPy |
int(sys.stdin.readline()) |
0.9229 |
2 |
PyPy |
map(int,os.read(0, 100000000).split('\n')) |
1.1169 |
3 |
PyPy3 |
map(int,os.read(0, 100000000).decode('utf-8').split('\n')) |
1.5408 |
4 |
PyPy |
int(raw_input()) |
1.925 |
5 |
Python 3 |
map(int,os.read(0, 100000000).decode('utf-8').split('\n')) |
4.4033 |
6 |
Python 3 |
int(sys.stdin.readline()) |
4.4394 |
7 |
PyPy3 |
int(sys.stdin.readline()) |
6.6291 |
8 |
Python 3 |
int(input()) |
12.4443 |
9 |
PyPy3 |
int(input()) |
17.3772 |
10 |
PyPy |
input() |
110.3676 |
출력속도
1 |
PyPy |
for i in xrange(1,n+1): sys.stdout.write(str(i)+'\n') |
0.9847 |
2 |
PyPy3 |
for i in range(1,n+1): sys.stdout.write(str(i)+'\n') |
1.3722 |
3 |
PyPy |
print '\n'.join(map(str,xrange(1,n+1))) |
1.3738 |
4 |
PyPy |
sys.stdout.write('\n'.join(map(str,xrange(1,n+1)))) |
1.3772 |
5 |
PyPy |
for i in xrange(1,n+1): print i |
1.4968 |
6 |
Python 3 |
print('\n'.join(map(str,range(1,n+1)))) |
2.3312 |
7 |
Python 3 |
sys.stdout.write('\n'.join(map(str,range(1,n+1)))) |
2.337 |
8 |
PyPy |
sys.stdout.write(''.join(str(i)+'\n' for i in xrange(1,n+1))) |
2.3935 |
9 |
PyPy |
print ''.join(str(i)+'\n' for i in xrange(1,n+1)) |
2.3974 |
10 |
PyPy3 |
for i in range(1,n+1): print(i) |
3.051 |
ref
https://www.acmicpc.net/blog/view/56
https://www.acmicpc.net/blog/view/57