custom compression level for

Issue #1307 wontfix
Cristian Ciupitu created an issue

Saving large workbooks with 100K rows can take a lot of time. Being able to use a custom faster compression level could speed things up.

If I'm not mistaking the default compression level is zlib.Z_DEFAULT_COMPRESSION = 6, with faster options being zlib.Z_BEST_SPEED = 1 and maybe zlib.Z_NO_COMPRESSION = 0.

Comments (4)

  1. CharlieC

    I doubt this would make that much difference to be honest. Profiling suggests that type handling and styles is where most work is going on. But the real problem with the zip format is that you can’t stream to it as you can with gzip et al.

    If you really want it you could easily set this by monkey-patching.

  2. Cristian Ciupitu reporter

    Monkey-patching as in doing this at the beginning of the program before any other imports?

    import zlib
  3. CharlieC

    Well, that's a global setting, which could have unpleasant side-effects. Better would be to write your own replacement for openpyxl.writer.excel.save_workbook and replace this after loading openpyxl.

    I don’t know what you’re doing and what your timings are but I wouldn’t expect you to see much out of this. Any further discussion should be on the mailing list.

  4. Log in to comment