From 8bed09a401d3df211b36c2c8341f4456523eea88 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Sun, 22 Mar 2026 13:38:15 +0300 Subject: [PATCH] perf: pre-compile Python bytecode in portable build Add compileall step to build-dist-windows.sh that generates .pyc files for both app source and site-packages. Saves ~100-200ms on startup by skipping parse/compile on first import. --- build-dist-windows.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build-dist-windows.sh b/build-dist-windows.sh index 2f7ea11..4e4b500 100644 --- a/build-dist-windows.sh +++ b/build-dist-windows.sh @@ -348,6 +348,11 @@ mkdir -p "$DIST_DIR/data" "$DIST_DIR/logs" find "$APP_DIR" -name "*.map" -delete 2>/dev/null || true find "$APP_DIR" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true +# Pre-compile Python bytecode for faster startup +echo " Pre-compiling Python bytecode..." +python -m compileall -b -q "$APP_DIR/src" 2>/dev/null || true +python -m compileall -b -q "$SITE_PACKAGES" 2>/dev/null || true + # ── Create launcher ────────────────────────────────────────── echo "[8b/9] Creating launcher and packaging..."