perf: run yt-dlp from a zipapp on a portable Python

Replaces the official yt-dlp_macos sidecar. That build is PyInstaller
one-file and unpacks 37MB on every invocation, costing ~8s per call on
this machine — ruled out signing, xattrs and thinning the universal
binary as causes, and it is 8% CPU over 8s, so it is the unpack itself.
Every stream resolve paid it.

The 3MB zipapp on a trimmed portable CPython starts in ~0.45s, a 17x
improvement; a real stream resolve goes from ~10s to ~2.4s. macOS ships
only Python 3.9 and yt-dlp needs 3.10+, hence bundling an interpreter.

yt-dlp is now resolved as an argv prefix rather than a path, so a system
install (a plain script, instant) still takes precedence.

Bundle grows 153MB -> 219MB, which buys back the responsiveness.
This commit is contained in:
vincent
2026-08-29 12:07:09 +02:00
parent 50ad908f1e
commit 9e9f71b31b
5 changed files with 130 additions and 45 deletions
+5 -2
View File
@@ -45,9 +45,12 @@
"icons/icon.ico"
],
"externalBin": [
"binaries/yt-dlp",
"binaries/ffmpeg",
"binaries/ffprobe"
]
],
"resources": {
"resources/python": "python",
"resources/yt-dlp.pyz": "yt-dlp.pyz"
}
}
}