key/value store optimized for disk storage

Paul Rubin no.email at nospam.invalid
Fri May 4 02:59:59 EDT 2012


Steve Howell <showell30 at yahoo.com> writes:
>     compressor = zlib.compressobj()
>     s = compressor.compress("foobar")
>     s += compressor.flush(zlib.Z_SYNC_FLUSH)
>
>     s_start = s
>     compressor2 = compressor.copy()

I think you also want to make a decompressor here, and initialize it
with s and then clone it.  Then you don't have to reinitialize every
time you want to decompress something.

I also seem to remember that the first few bytes of compressed output
are always some fixed string or checksum, that you can strip out after
compression and put back before decompression, giving further savings in
output size when you have millions of records.



More information about the Python-list mailing list