repl.it
@Scoder12/

benchmark ram

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import sys

data = [
    b"a" * 100000000
] # 100 million char string: 100 mb (+33 bytes)

while True:
    for i in range(1000000): # 10 million its
        data.append(data[0])
    mb = sys.getsizeof(data)/1000000
    if mb < 1000:
        print(f"size of array: {mb:,} MB")
    else:
        print(f"size of array: {mb/1000:,} GB")
?