파이썬 입출력 속도 비교.
입력속도
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
'practivceAlgorithm > PYTHON 기능연습' 카테고리의 다른 글
[Python] Python List, Dictionary, Set등 참조형 자료구조 복사 (0) | 2022.07.24 |
---|---|
[Python] zfill과 rjust : 문자의 자릿수를 맞춰주자! (0) | 2021.09.01 |
[문자열 뒤집기] 문자열 슬라이싱 (0) | 2021.08.18 |
파이썬 개인적으로 기억해야 할 것 정리(210721) (0) | 2021.07.21 |
[Python] 특정 문자열 찾기.(find응용) (0) | 2021.07.17 |