title: What's the most space-efficient way to compress serialized Python data?
body: <p>From <a href="https://docs.python.org/3/library/pickle.html" rel="noreferrer">the Python documentation</a>:</p>
  
  <blockquote>
    <p>By default, the pickle data format uses a relatively compact binary representation. If you need optimal size characteristics, you can efficiently compress pickled data.</p>
  </blockquote>
  
  <p>I'm going to be serializing several gigabytes of data at the end of a process that runs for several hours, and I'd like the result to be as small as possible on disk. However, <a href="https://docs.python.org/3/library/archiving.html" rel="noreferrer">Python offers several different ways to compress data</a>.</p>
  
  <p>Is there one of these that's particularly efficient for pickled files? The data I'm pickling mostly consists of nested dictionaries and strings, so if there's a more efficient way to compress e.g. JSON, that would work too.</p>
  
  <p>The time for compression and decompression isn't important, but the time this process takes to generate the data makes trial and error inconvenient.</p>