Skip to content

v1.7.0

Choose a tag to compare

@geoff-davis geoff-davis released this 01 Jun 11:18
· 23 commits to main since this release
b4933f7

Added

  • Optional aiogzip[fast] extra that installs zlib-ng. When present, decompression automatically uses zlib-ng, which is faster (~1.6–2x on typical data) and produces byte-identical output to stdlib zlib. Set the environment variable AIOGZIP_ENGINE=stdlib to force stdlib regardless of what is installed. When the extra is not installed, aiogzip remains pure-Python and behaves exactly as before.
  • fast_compress=True option on AsyncGzipBinaryFile, AsyncGzipTextFile, and the AsyncGzipFile factory to opt into zlib-ng for compression (~1.2–1.4x). Compression stays on stdlib zlib by default because zlib-ng's compressed output is not byte-identical — installing the extra alone does not change produced .gz bytes. If fast_compress=True is requested without zlib-ng installed, it warns once and falls back to stdlib. zlib-ng output remains valid gzip readable by any decompressor.

Performance

  • Line iteration in AsyncGzipTextFile (async for / readline()) is faster for the single-character newline modes (None, "\n", "\r"): each decoded chunk's complete lines are bulk-split in one pass and served from a batch instead of scanned one at a time. ~1.3x for async for and ~1.16x for readline() loops; the batch is capped per refill so a large chunk_size does not increase peak memory unboundedly.