Compress large Integers into smallest possible string

Yes. GZIP is a compression algorithm which both requires compressible data and has an overhead (framing and dictionaries, etc). An encoding algorithm should be used instead. The “simple” method is to use base-64 encoding. That is, convert the number (which is represented as base 10 in the string) to the actual series of bytes that … Read more

What’s the most space-efficient way to compress serialized Python data?

I’ve done some test using a Pickled object, lzma gave the best compression. But your results can vary based on your data, I’d recommend testing them with some sample data of your own. Mode LastWriteTime Length Name —- ————- —— —- -a—- 9/17/2019 10:05 PM 23869925 no_compression.pickle -a—- 9/17/2019 10:06 PM 6050027 gzip_test.gz -a—- 9/17/2019 … Read more

What is the current state of text-only compression algorithms?

The boundary-pushing compressors combine algorithms for insane results. Common algorithms include: The Burrows-Wheeler Transform and here – shuffle characters (or other bit blocks) with a predictable algorithm to increase repeated blocks which makes the source easier to compress. Decompression occurs as normal and the result is un-shuffled with the reverse transform. Note: BWT alone doesn’t … Read more

Create Zip archive from multiple in memory files in C#

Use ZipEntry and PutNextEntry() for this. The following shows how to do it for a file, but for an in-memory object just use a MemoryStream FileStream fZip = File.Create(compressedOutputFile); ZipOutputStream zipOStream = new ZipOutputStream(fZip); foreach (FileInfo fi in allfiles) { ZipEntry entry = new ZipEntry((fi.Name)); zipOStream.PutNextEntry(entry); FileStream fs = File.OpenRead(fi.FullName); try { byte[] transferBuffer[1024]; do … Read more