title: Can I improve the poor performance of the Rust zip crate?
body: <p>Here is my benchmark program:</p>
  
  <pre><code>extern crate zip;
  
  use std::fs::File;
  use std::io::copy;
  use zip::write::FileOptions;
  use zip::ZipWriter;
  
  fn main() {
      let mut src = File::open("/tmp/src.mxf").unwrap(); // 624 Mb file.
      let dest = File::create("/tmp/test.zip").unwrap();
      let mut zip_writer = ZipWriter::new(dest);
  
      zip_writer
          .start_file("src.mxf", FileOptions::default())
          .unwrap();
      copy(&amp;mut src, &amp;mut zip_writer).unwrap();
  
      zip_writer.finish().unwrap();
  }
  </code></pre>
  
  <p>With the program compiled in release mode:</p>
  
  <pre class="lang-none prettyprint-override"><code>time ./zip_bench
  ./zip_bench  62,68s user 146,21s system 99% cpu 3:28,91 total
  </code></pre>
  
  <p>The same file compressed using the system <code>zip</code> binary:</p>
  
  <pre class="lang-none prettyprint-override"><code>time zip /tmp/test2.zip /tmp/src.mxf
  zip /tmp/test2.zip /tmp/src.mxf  13,77s user 0,19s system 99% cpu 13,965 total
  </code></pre>
  
  <p>The time factor between the system and Rust zip is around 14x (for a similar output file, with insignificant size difference).</p>
  
  <p>Am I doing something wrong in the code that could explain Rust performance? How can I improve it to approach system performance?</p>