Skip to content

Commit 4116c93

Browse files
committed
Update README with usage and installation information
1 parent 8c7d733 commit 4116c93

File tree

1 file changed

+77
-1
lines changed

1 file changed

+77
-1
lines changed

README.rst

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,80 @@ Python bindings for the `isa-l <https://github.com/intel/isa-l>`_ library.
55

66
The Intel Infrastructure Storage Acceleration Library (isa-l) implements several key
77
algorithms in `assembly language <https://en.wikipedia.org/wiki/Assembly_language>`_.
8-
This includes the DEFLATE algorithm which is used in `gzip`.
8+
This includes the DEFLATE algorithm which is used in ``gzip``.
9+
10+
Installation
11+
------------
12+
13+
isa-l version 2.26.0 or higher is needed. This includes bindings for the
14+
adler32 function.
15+
16+
isa-l is available in numerous Linux distro's as well as on conda via the
17+
conda-forge channel. Checkout the `ports documentation
18+
<https://github.com/intel/isa-l/wiki/Ports--Repos>`_ on the isa-l project wiki
19+
to find out how to install it.
20+
21+
The latest development version of python-isal can be installed with
22+
23+
.. code-block::
24+
25+
pip install git+https://github.com/rhpvorderman/python-isal.git
26+
27+
Usage
28+
-----
29+
30+
Python-isal has faster versions of the stdlib's ``zlib`` and ``gzip`` module
31+
these are called ``isal_zlib`` and ``igzip`` respectively.
32+
33+
They can be imported as follows
34+
35+
.. code-block:: python
36+
37+
from isal import isal_zlib
38+
from isal import igzip
39+
40+
``isal_zlib`` and ``igzip`` were meant to be used as drop in replacements so
41+
their api and functions are the same as the stdlib's modules. Except where
42+
isa-l does not support the same calls as zlib (See differences below).
43+
44+
``python -m isal.igzip`` implements a simple gzip-like command line
45+
application (just like ``python -m gzip``).
46+
47+
Differences with zlib and gzip modules
48+
--------------------------------------
49+
50+
+ Compression level 0 in ``zlib`` and ``gzip`` means **no compression**, while
51+
in ``isal_zlib`` and ``igzip`` this is the **lowest compression level**.
52+
This is a design choice that was inherited from the isa-l library.
53+
+ Compression levels range from 0 to 3, not 1 to 9.
54+
+ ``isal_zlib.crc32`` and ``isal_zlib.adler32`` do not support negative
55+
numbers for the value parameter.
56+
+ ``zlib.Z_DEFAULT_STRATEGY``, ``zlib.Z_RLE`` etc. are exposed as
57+
``isal_zlib.Z_DEFAULT_STRATEGY``, ``isal_zlib.Z_RLE`` etc. for compatibility
58+
reasons. However, ``isal_zlib`` only supports a default strategy and will
59+
give warnings when other strategies are used.
60+
+ ``zlib`` supports different memory levels from 1 to 9 (with 8 default).
61+
``isal_zlib`` supports memory levels smallest, small, medium, large and
62+
largest. These have been mapped to levels 1, 2-3, 4-6, 7-8 and 9. So
63+
``isal_zlib`` can be used with zlib compatible memory levels.
64+
+ ``isal_zlib`` only supports ``FLUSH``, ``SYNC_FLUSH`` and ``FULL_FLUSH``
65+
``FINISH`` is aliased to ``FULL_FLUSH`` (and works correctly as such).
66+
+ ``isal_zlib`` has a ``compressobj`` and ``decompressobj`` implementation.
67+
The resulting objects only support a maximum of 4 GB input for their
68+
``compress`` and ``decompress`` methods unlike ``zlib`` which supports
69+
an unlimited size. This difference arises because
70+
the zlib C library only supports very small amounts (64 KB) of input and the
71+
python zlibmodule.c has created a workaround so larger amounts can be
72+
supported. This workaround allows anything up to the maximum size that python
73+
can describe.
74+
However for isa-l the maximum supported size is 4GB. for isal_zlib it was
75+
decided that since the ``compressobj`` and ``decompressobj`` are only used in
76+
streaming applications, 4 GB is ample. This simplifies the underlying code
77+
quite a bit. If you need to compress or decompress larger sizes than 4 GB
78+
in memory then the ``compress`` and ``decompress`` methods support this.
79+
80+
Contributing
81+
------------
82+
Please make a PR or issue if you feel anything can be improved. Bug reports
83+
are also very welcome. Please report them on the `github issue tracker
84+
<https://github.com/rhpvorderman/python-isal/issues>`_.

0 commit comments

Comments
 (0)