Last active
December 21, 2016 17:47
-
-
Save vtermanis/ddb42d56dcc8110623938ff4a643e09f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from time import monotonic | |
from lz4framed import compress | |
SHORT_INPUT = b'abcdefghijklmnopqrstuvwxyz0123456789' | |
LONG_INPUT = SHORT_INPUT * (10**5) | |
# Input a byte shorter than below does not trigger slowdown (for new lz4, not r131) | |
# LONG_INPUT = LONG_INPUT[:65550] | |
def comp(input_raw, level): | |
start = monotonic() | |
result = compress(input_raw, level=level) | |
end = monotonic() | |
print('% 5.3f, Level %2d, output size: %d' % ((end - start), level, len(result))) | |
def main(): | |
print('Input length: %s' % len(LONG_INPUT)) | |
for level in range(17): | |
comp(LONG_INPUT, level) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Module build output for lz4 & py-lz4framed (same for both):