python-zstandard icon indicating copy to clipboard operation
python-zstandard copied to clipboard

use BlocksOutputBuffer for DecompressionObj / CompressionObj

Open animalize opened this issue 4 years ago • 1 comments

The test in #119 improved:

0   0.000
10  0.005
20  0.011
30  0.017
40  0.024
50  0.028
60  0.034
70  0.043
80  0.051
90  0.055
100 0.058

animalize avatar Feb 13 '21 03:02 animalize

The third commit fixed a bug, if an error occured, result object is not DECREFed.

    while (1) {
        Py_BEGIN_ALLOW_THREADS zresult = ZSTD_compressStream2(
            self->compressor->cctx, &self->output, &input, zFlushMode);
        Py_END_ALLOW_THREADS

            if (ZSTD_isError(zresult)) {
            PyErr_Format(ZstdError, "error ending compression stream: %s",
                         ZSTD_getErrorName(zresult));
            return NULL;  // <---- this line
        }

ghost avatar Feb 13 '21 04:02 ghost