Compression

mosaic.comms.compression.maybe_compress(payload, min_size=10000.0, sample_size=10000.0, nsamples=5)[source]

Maybe compress payload:

  1. We don’t compress small messages

  2. We sample the payload in a few spots, compress that, and if it doesn’t do any good we return the original

  3. We then compress the full original, it it doesn’t compress well then we return the original

  4. We return the compressed result

mosaic.comms.compression.decompress(compression, payload)[source]

Decompress payload according to information in the header