numpy-cache Library Uses LZ4 Compression to Speed Up NumPy Array Disk I/O
A new open-source Python library called numpy-cache has been released to address a long-standing performance gap in NumPy's disk caching options. Standard methods like np.save() offer fast writes but no compression, while np.savez_compressed() compresses well but can take over three seconds on a 100 MB array due to slow single-threaded zlib processing. numpy-cache bridges this gap by combining a C-extension with the LZ4 compression algorithm, achieving write times of around 100 milliseconds on 100 MB arrays — roughly 20 times faster than np.savez_compressed(). The library uses direct memory access via NumPy's buffer protocol to minimize data copying and exposes a configurable acceleration parameter so developers can tune the speed-to-compression tradeoff. It supports all standard numeric dtypes and multi-dimensional arrays, and is designed to integrate into existing codebases with minimal API changes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in