Repository navigation
Closed
Description
Sub-issue of #112 (iter8 candidate 2).
Hypothesis
uv_sync is consistently the second-largest phase in the iter7 timing:
| phase | iter7 cold | iter7 warm |
|---|---|---|
| uv_sync | 22.34s | 22.35s (no cache benefit) |
| compile | 142.33s | 135.67s |
The warm tarball packs ~/.fbuild, ~/.fastled/global_cache, fastled/.build/pio/<board>, and ${ZCCACHE_CACHE_DIR} — but not fastled/.venv. So every warm run still pays the full 22s to download + install fbuild + dependencies into a fresh virtual environment.
fastled/.venv after uv sync is typically 200–400 MB and contains: a Python interpreter symlink, pip/uv metadata, and the resolved package tree. Pack it into the same tarball and uv sync becomes a no-op (lockfile match → instantly resolved).
Plan
- Add
\$GITHUB_WORKSPACE/fastled/.venvto thepathsarray in the "Phase - pack cache tarball" step of.github/workflows/benchmark.yml. - The warm-restore step already
tar -xPfs with absolute paths, so the venv will materialize at the expectedfastled/.venvlocation after restore. - In the "Phase - uv sync FastLED venv" step, run
uv syncanyway — if the lockfile matches the restored venv,uv syncis sub-second. If FastLED'spyproject.tomlor lockfile changed between the artifact-source run and now,uv syncwill reconcile correctly. - Watch for
.venvcontent that doesn't survive tarballing: symlinks to system Python, absolute-path shebangs,RECORDfile hashes. Onubuntu-latestwith the sameactions/setup-pythonversion pinned (3.12), this should be stable.
Edge cases to handle
actions/setup-pythoninterpreter path changes between runs. Mitigation: pack with--dereferenceso the venv carries its own Python bin copy, or rerunuv sync --reinstall-package pythondefensively before the compile step.pyproject.toml/uv.lockdrift on FastLED master between runs. The current workflow already runsuv syncafter restore, so dependency-set changes are reconciled — venv cache becomes a head-start, not a hard requirement.- Tarball bloat. Current artifact is ~64 MB compressed. Adding a venv may push it to 100–150 MB. Well below
actions/upload-artifact's practical limits.
Expected savings
| scenario | uv_sync | warm total |
|---|---|---|
| iter7 baseline | 22.35s | 198s |
| with venv cached | ~3s (lock check + manifest) | ~178s |
| stacked with iter8a parallel | ~3s | ~115s |
Acceptance
- Warm
uv_sync≤ 5s. - No new failure mode in the compile phase from a stale venv (run the same FastLED ref before/after to confirm reproducibility).
- Tarball compressed size ≤ 200 MB.
- Cold-run timings unchanged vs iter7 (this is a warm-only optimization).
Out of scope
- Caching
uv's global package cache.astral-sh/setup-uv@v6already hasenable-cache: trueset in the workflow, but that only restoresuv's package cache, not the resolved venv — souv syncstill has to materialize the tree per run. Layering the venv on top eliminates the materialization cost itself.
Related
- [META] Fastest possible FastLED examples CI rebuild — profile + benchmark #112 — meta tracker
- Iter7 baseline (last comment on [META] Fastest possible FastLED examples CI rebuild — profile + benchmark #112)
- Independent of iter8a (parallel compile), both stack.
Metadata
Metadata
Assignees
Labels
No labels
Activity
bench iter8b: cache fastled/.venv to cut warm uv_sync 22s → <5s (#239) (
zackees commentedon May 13, 2026
Implementation landed in #240 (bench/fastled-examples orphan branch): fastled/.venv now ships in the warm-cache tarball with tar --dereference for interpreter symlinks. Warm-run validation tracked in #250. Closing — reopen if timings miss the <=5s target.