apppublic/test/brotli_test.py
2023-02-23 15:17:24 +08:00

15 lines
281 B
Python
Executable File

import sys
from brotli import compress, decompress
import zlib
def do(fn):
with open(fn, 'rb') as f:
b = f.read()
c = compress(b)
zc = zlib.compress(b)
print(fn,'\t',
float(len(c))/float(len(b)), float(len(zc))/float(len(b)))
fns = sys.argv[1:]
for fn in fns:
do(fn)