def test_performance_sequential(n, length): _str = random_string(length) _strarr = [_str for _ in range(n)] now = dt.now() [c.decompress(y) for y in [c.compressHC(x) for x in _strarr]] clz4_time = (dt.now() - now).total_seconds() now = dt.now() c.decompressarr(c.compressarrHC(_strarr)) clz4_time_p = (dt.now() - now).total_seconds() now = dt.now() [lz4.decompress(y) for y in [lz4.compressHC(x) for x in _strarr]] lz4_time = (dt.now() - now).total_seconds() print() print("LZ4 Test %sx len:%s" % (n, length)) print(" Cython LZ4 %s s" % clz4_time) print(" Cython LZ4 Parallel %s s" % clz4_time_p) print(" LZ4 %s s" % lz4_time)
def test_arr_zero(): assert [] == c.compressarrHC([]) assert [] == c.decompressarr([])
def test_roundtrip_arrHC(n, length): _strarr = [random_string(length) for _ in range(n)] cstr = c.compressarrHC(_strarr) assert _strarr == c.decompressarr(cstr)