How to use the lz4.compress function in lz4

To help you get started, we’ve selected a few lz4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebookexperimental / eden / tests / stresstest-compress.py View on Github external
for modname, func in [("pylz4", pylz4.compress), ("rustlz4", rustlz4.compress)]:
        timer = timeit.Timer(functools.partial(func, data))
        elapsed = timer.timeit(number=number)
        perf = size * number / elapsed / 1e6
        name = "%s.%s" % (modname, func.__name__)
        print("%24s: %8.2f MB/s" % (name, perf))

    for modname, func in [("pylz4", pylz4.compressHC), ("rustlz4", rustlz4.compresshc)]:
        timer = timeit.Timer(functools.partial(func, hcdata))
        elapsed = timer.timeit(number=number)
        perf = size * number / elapsed / 1e6
        name = "%s.%s" % (modname, func.__name__)
        print("%24s: %8.2f MB/s" % (name, perf))

    data = pylz4.compress(data)
    for modname, func in [("pylz4", pylz4.decompress), ("rustlz4", rustlz4.decompress)]:
        timer = timeit.Timer(functools.partial(func, data))
        elapsed = timer.timeit(number=number)
        perf = size * number / elapsed / 1e6
        name = "%s.%s" % (modname, func.__name__)
        print("%24s: %8.2f MB/s" % (name, perf))
github RoboJackets / roboracing-software / rr_ml / end_to_end / example_set.py View on Github external
def __init__(self, img, angle):
        self.img_buf = lz4.compress(img)
        self.img_shape = img.shape
        self.angle = angle
github cheshire3 / cheshire3 / cheshire3 / preParser.py View on Github external
def process_document(self, session, doc):
        data = doc.get_raw(session)
        new = lz4.compress(data)
        return StringDocument(new, self.id, doc.processHistory,
                              parent=doc.parent, filename=doc.filename)
github RoboJackets / roboracing-software / rr_ml / end_to_end / example_set.py View on Github external
def save(self, fname):
        with open(fname, 'w') as f:
            f.write(lz4.compress(pickle.dumps(self)))