I use a dictionary to store unique keys mapped to unique values.
First keys were str and values int. I used sys.getsizeof(dict) to get the size and i also printed the dict into a file.
debugggg = csv.writer(open("debug1.txt", 'w'))
for key, val in diction.items():
debugggg.writerow([key, val])
I got 296 MB from the file and 805306648 from sys.getsizeof()
Then as values I stored the same keys but this time I hashed them before mapping
diction[hash(mykey_1)] = value_1
And I was expecting this to be a bit more compressed than the previous approach.
I ran the same functions to get the size. From the file i got 362MB(!) and from sys.getsizeof() i got the same result as previous (805306648)
Time for process was the same , as it was expected O(1) lookups. But I am a bit confused about the sizes.