import math items = 50000000 def risparmio(card, size): bits = math.ceil(math.log(card,2)) print bits plain_size = size * items print (plain_size/1024**3) dictionary_size = size * card print (dictionary_size/(1024**2)) column_size = items * (bits/8) print (column_size/(1024**3)) compressed_size = dictionary_size + column_size return plain_size, compressed_size plain, compr = 0, 0 fields = [(20000, 49), (100000, 49), (128, 1), (2, 1)] for field in fields: dp, dc = risparmio(*field) plain += dp compr += dc print print plain/compr
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question