Created
August 18, 2017 03:54
-
-
Save albow-net/8abf92ff1368111dbb3b0b62c5a61789 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
def test_array( N, num ): | |
# 長さNの配列を用意し0で初期化 | |
array = N * [0] | |
# 各要素にnumを代入 | |
for i in range(N): | |
array[i] = num | |
# 各要素の和を計算 | |
sum = 0 | |
for a in array: | |
sum += a | |
return sum | |
if __name__ == '__main__': | |
N = 1 << 26 | |
num = 3 | |
print( test_array( N, num ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment