Skip to content

Instantly share code, notes, and snippets.

@kolotaev
Last active February 20, 2020 15:05
Show Gist options
  • Save kolotaev/eb702bec19863e12741e42101b8d6c6e to your computer and use it in GitHub Desktop.
Save kolotaev/eb702bec19863e12741e42101b8d6c6e to your computer and use it in GitHub Desktop.
import gzip
import sys
s = """
aaaa
"""
se = s.encode("utf8")
sez = gzip.compress(se)
raw_size = len(se)
zipped_size = len(sez)
print('raw: ', raw_size / 1000, ' kB')
print('gzipped: ', zipped_size / 1000, ' kB')
rps = int(sys.argv[1]) if len(sys.argv) == 2 else 100
seconds_in_month = 60 * 60 * 24 * 30
rpm = seconds_in_month * rps
takes = zipped_size * rpm / 1000000000000
print('gzipped takes %f TB monthly at %i requests per_second rate' % (takes, rps))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment