Skip to content

Instantly share code, notes, and snippets.

@methane

methane/0.ss.py Secret

Last active March 6, 2019 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save methane/98b7f43fc00a84964f66241695112e91 to your computer and use it in GitHub Desktop.
Save methane/98b7f43fc00a84964f66241695112e91 to your computer and use it in GitHub Desktop.
import sys
for i in range(8):
j = 10**i
for k in (1, 2, 4, 7):
l = j*k
s = sys.getsizeof(set(range(j*k)))
print(f"{l:>10,} {s:>13,}")
len master ordered set
1 216 168
2 216 168
4 216 168
7 728 312
10 728 456
20 2,264 744
40 2,264 1,320
70 2,264 2,472
100 8,408 2,472
200 8,408 5,288
400 32,984 10,408
700 32,984 20,648
1,000 32,984 20,648
2,000 131,288 41,128
4,000 131,288 82,088
7,000 524,504 164,008
10,000 524,504 327,848
20,000 2,097,368 655,528
40,000 2,097,368 1,573,032
70,000 2,097,368 3,145,896
100,000 4,194,520 3,145,896
200,000 8,388,824 6,291,624
400,000 16,777,432 12,583,080
700,000 33,554,648 25,165,992
1,000,000 33,554,648 25,165,992
2,000,000 67,109,080 50,331,816
4,000,000 134,217,944 100,663,464
7,000,000 268,435,672 201,326,760
10,000,000 268,435,672 402,653,352
20,000,000 536,871,128 805,306,536
40,000,000 1,073,742,040 1,610,612,904
70,000,000 2,147,483,864 3,221,225,640
1 216
2 216
4 216
7 728
10 728
20 2,264
40 2,264
70 2,264
100 8,408
200 8,408
400 32,984
700 32,984
1,000 32,984
2,000 131,288
4,000 131,288
7,000 524,504
10,000 524,504
20,000 2,097,368
40,000 2,097,368
70,000 2,097,368
100,000 4,194,520
200,000 8,388,824
400,000 16,777,432
700,000 33,554,648
1,000,000 33,554,648
2,000,000 67,109,080
4,000,000 134,217,944
7,000,000 268,435,672
10,000,000 268,435,672
20,000,000 536,871,128
40,000,000 1,073,742,040
70,000,000 2,147,483,864
1 168
2 168
4 168
7 312
10 456
20 744
40 1,320
70 2,472
100 2,472
200 5,288
400 10,408
700 20,648
1,000 20,648
2,000 41,128
4,000 82,088
7,000 164,008
10,000 327,848
20,000 655,528
40,000 1,573,032
70,000 3,145,896
100,000 3,145,896
200,000 6,291,624
400,000 12,583,080
700,000 25,165,992
1,000,000 25,165,992
2,000,000 50,331,816
4,000,000 100,663,464
7,000,000 201,326,760
10,000,000 402,653,352
20,000,000 805,306,536
40,000,000 1,610,612,904
70,000,000 3,221,225,640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment