From d6aee9a0e23c1b389b6c5d1e6b6f02e443c32e8a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 24 Jan 2022 21:32:31 +1000 Subject: [PATCH] disable compression on backup zips again When backups were moved into a separate thread 5 years ago, it improved performance when switching between different profiles, as the backup happened in the background. But when closing Anki, we wait on the background thread to complete, so Anki hangs until the backup finishes. The performance difference on a large collection is considerable: - 0.45s without compression - 7.9s with compression Given that the majority of users probably aren't using multiple profiles, I think the speed increase is probably worth the extra disk usage. In the future, we may want to look into using zstd to compress the backups, which may even be a performance win over the uncompressed version on some devices. --- qt/aqt/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 32004b81c..0d7e11a19 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -650,7 +650,7 @@ class AnkiQt(QMainWindow): pass def run(self) -> None: - z = zipfile.ZipFile(self.path, "w", zipfile.ZIP_DEFLATED) + z = zipfile.ZipFile(self.path, "w", zipfile.ZIP_STORED) z.writestr("collection.anki2", self.data) z.writestr("media", "{}") z.close()