From af3256e41edbd611ddf83cede277a216a8da8ad9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 27 Jan 2024 13:06:32 -1000 Subject: [PATCH] Significantly speed up creating backups with isal via zlib-fast isal is a drop in replacement for zlib with the cavet that the compression level mappings are different. zlib-fast is a tiny piece of middleware to convert the standard zlib compression levels to isal compression levels to allow for drop-in replacement https://github.com/bdraco/zlib-fast/releases/tag/v0.1.0 https://github.com/pycompression/python-isal Compression for backups is ~5x faster than the baseline https://github.com/powturbo/TurboBench/issues/43 --- requirements.txt | 1 + supervisor/__main__.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 46cba2d73..95fc650b5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,3 +27,4 @@ setuptools==69.0.3 voluptuous==0.14.1 dbus-fast==2.21.0 typing_extensions==4.9.0 +zlib-fast==0.1.0 diff --git a/supervisor/__main__.py b/supervisor/__main__.py index e43fff583..c6886e330 100644 --- a/supervisor/__main__.py +++ b/supervisor/__main__.py @@ -5,8 +5,13 @@ import logging from pathlib import Path import sys -from supervisor import bootstrap -from supervisor.utils.logging import activate_log_queue_handler +import zlib_fast + +# Enable fast zlib before importing supervisor +zlib_fast.enable() + +from supervisor import bootstrap # noqa: E402 +from supervisor.utils.logging import activate_log_queue_handler # noqa: E402 _LOGGER: logging.Logger = logging.getLogger(__name__)