From 89cf17c96f1fe780a8aba62930411107ad2c7e59 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 29 Oct 2021 16:50:13 +0200 Subject: Use maximum zlib compression when generating editor translation headers With comments stripped, this reduces the combined generated translation size from 28.7 MB to 28.4 MB (-240 KB). --- editor/editor_builders.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'editor') diff --git a/editor/editor_builders.py b/editor/editor_builders.py index ff0daa86ff..67d4b8534f 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -26,7 +26,9 @@ def make_doc_header(target, source, env): decomp_size = len(buf) import zlib - buf = zlib.compress(buf) + # Use maximum zlib compression level to further reduce file size + # (at the cost of initial build times). + buf = zlib.compress(buf, zlib.Z_BEST_COMPRESSION) g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _DOC_DATA_RAW_H\n") @@ -92,7 +94,9 @@ def make_translations_header(target, source, env, category): with open(sorted_paths[i], "rb") as f: buf = f.read() decomp_size = len(buf) - buf = zlib.compress(buf) + # Use maximum zlib compression level to further reduce file size + # (at the cost of initial build times). + buf = zlib.compress(buf, zlib.Z_BEST_COMPRESSION) name = os.path.splitext(os.path.basename(sorted_paths[i]))[0] g.write("static const unsigned char _{}_translation_{}_compressed[] = {{\n".format(category, name)) -- cgit v1.2.3