diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a415bee3..19d9ff25 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,17 @@ Changelog .. This document is user facing. Please word the changes in such a way .. that users understand how the changes affect the new version. +version 1.3.0 +----------------- ++ Gzip headers are now actively checked for a BGZF extra field. If found the + block size is taken into account when decompressing. This has further + improved bgzf decompression speed by 5% on some files compared to the + more generic solution of 1.2.0. ++ Integrated CPython 3.11 code for reading gzip headers. This leads to more + commonality between the python-isal code and the upstream gzip.py code. + This has enabled the change above. It comes at the cost of a slight increase + in overhead at the ``gzip.decompress`` function. + version 1.2.0 ----------------- + Bgzip files are now detected and a smaller reading buffer is used to diff --git a/setup.py b/setup.py index 9179a620..95d574d2 100644 --- a/setup.py +++ b/setup.py @@ -135,7 +135,7 @@ def build_isa_l(): setup( name="isal", - version="1.2.0", + version="1.3.0", description="Faster zlib and gzip compatible compression and " "decompression by providing python bindings for the ISA-L " "library.", diff --git a/src/isal/__init__.py b/src/isal/__init__.py index ca2025f0..34f3a553 100644 --- a/src/isal/__init__.py +++ b/src/isal/__init__.py @@ -27,4 +27,4 @@ "__version__" ] -__version__ = "1.2.0" +__version__ = "1.3.0" diff --git a/src/isal/igzip.py b/src/isal/igzip.py index 167c1f4f..7c650ce7 100644 --- a/src/isal/igzip.py +++ b/src/isal/igzip.py @@ -220,20 +220,80 @@ def write(self, data): return length -def detect_bgzip(header: bytes) -> bool: - if len(header) < 18: - return False - magic, method, flags, mtime, xfl, os, xlen, si1, si2, slen, bsize = \ - struct.unpack(" int: - """ - Find the start of the raw deflate block in a gzip file. - :param data: Compressed data that starts with a gzip header. - :return: The end of the header / start of the raw deflate block. - """ - eof_error = EOFError("Compressed file ended before the end-of-stream " - "marker was reached") - if len(data) < 10: - raise eof_error - # We are not interested in mtime, xfl and os flags. - magic, method, flags = struct.unpack("