Skip to content

perf(ci): investigate 20-minute Linux unit job, cold_skip misses, and example runtime #4529

Open

Description

@zackees

Problem

The Linux unit-test job for PR #4511 passed 310/310 tests but took 20m12s in https://github.com/FastLED/FastLED/actions/runs/35809747697/job/107018475769?pr=4511 (commit acfc3ee). Runner timing: Meson setup 3.92s, compilation 1130.84s (core/PCH 196.25s, objects 422.62s, test linking 326.91s), test execution 75.64s. Examples were not requested.

Zccache reported 345 requests, 0 hits / 345 misses, and 100% cold_skip despite a populated depgraph on disk; its warning refers to #320 / #796 SI-2. A fresh hosted runner may legitimately have no reusable objects, so this warning alone does not prove zccache caused the delay.

.github/workflows/template_unit_test.yml runs ./test --clang --no-parallel --unit --verbose --debug --log-failures failures. This combines serialized compilation with full debug mode. The example-test template also uses --no-parallel --examples --verbose --debug; investigate its timing separately, including whether example execution loops repeat unnecessarily.

Investigation / fix

  1. Capture phase timings, runner CPU/memory pressure, compiler/build flags, Ninja job count, link commands, and zccache miss reasons. Compare clean and warm runs of the same revision. Determine whether cold_skip is expected first-build behavior, absent persisted cache, or a classifier defect; link/file the zccache-owner issue if needed.
  2. Benchmark safe variants: bounded parallelism, quick versus debug/sanitizer mode, PCH/link strategy, and cache persistence. Explain the 326.91s linking segment. Preserve intended coverage and diagnostics.
  3. Separately measure example-workflow compilation and runtime, identify repeated example iterations/loops, and reduce redundant iterations where coverage remains intact.
  4. Implement measured improvements and add a visible performance regression signal.

Acceptance criteria (RED → GREEN)

  • RED: Document this 20m12s baseline (1130.84s compilation, 75.64s execution, 0/345 hits, 100% cold_skip) and comparable clean/warm baselines for unit and example workflows.
  • GREEN: A follow-up PR identifies dominant causes and measurably improves unit-job wall time on comparable hosted runners, with before/after phase timings. If zero hits is expected on fresh runners, correct the misleading warning; otherwise fix/link the cache problem and demonstrate warm hits.
  • GREEN: Measure example iteration counts and reduce redundant work safely; report example before/after runtime separately.
  • GREEN: All 310 unit tests and intended example coverage still pass. Document any debug/sanitizer or parallelism tradeoff.

Decisions

  • Track in FastLED because its CI workflow and runner configuration are actionable here; split/link a zccache defect only after confirming behavior.
  • Example timing is related but not the cause of this unit-only job.
  • Do not call zero hits a regression without a warm-cache comparison.

Activity

  1. zackees commented on Sep 23, 2026

    @zackees
    MemberAuthor

    Local follow-up (2026-09-22): src/platforms/stub_main.hpp caps host example execution at five loop() iterations when FASTLED_STUB_MAIN_FAST_EXIT is defined by ci/meson/native/meson.build. A full local bash test --cpp after the current color-profile changes passed 307/307 unit modules and 114/114 examples in 305.02s: 295.36s compilation (253.42s test/example linking) versus 8.16s total test execution. This is a warm/local quick-mode run, not directly comparable to the cited hosted debug unit-only 1212s run, but it reinforces that reducing example loop iterations cannot explain that unit-only job and is unlikely to dominate this local run. Keep example iteration reduction conditional on separate per-example runtime and coverage measurements; prioritize link/build investigation.

  2. zackees commented on Sep 23, 2026

    @zackees
    MemberAuthor

    Root-cause analysis (PR #4511 Linux runs)

    The 20m12s is predominantly a cold debug C++ build, not test execution or examples. In the unit job, compilation took 1130.84s (93.4% of the ./test step), versus 75.64s running all 310 tests. Linking alone was reported as 326.91s. The job used Clang 21, -Og -g3, ASan and UBSan; Meson creates a separate shared library for each test. That build graph and instrumentation explain why cold compilation/linking are the first things to optimize, though a link-command/CPU profile is still needed to attribute the full 326.91s. A later unit run showed the same shape (1212.82s compilation, 66.21s execution, 0/345 zccache hits), so this is not just one slow run.

    Correction to this issue's description: --no-parallel does not serialize the unit compilation here. It reduces test execution to one worker (argument handling); the Meson compile command supplies no -j 1, and the log shows multiple zccache compiles in flight. Dropping that flag may help the ~76s execution phase if tests are safe to parallelize, but cannot by itself fix the ~1131s compile phase.

    Why 0 hits and the cold_skip warning: This workflow caches Rust lint output and uv dependencies, but does not restore/save C++ zccache objects or its depgraph. GitHub-hosted jobs start on fresh VMs; 0/345 hits is therefore expected on a first build, not evidence of a cache regression. In the zccache 1.14.10 code used by this run, the warning tests whether the depgraph exists at session end, then compares it with session-wide cold-skip counts. A cold session can create that graph before the check. Thus “100% cold_skip despite populated depgraph” is a misleading warning in this case, not proof that the earlier warm-cache bugs #320/#796 recur. The warning should key off graph state at session start (or a verified warm baseline).

    Examples are separate. The PR's Linux example job took 6m43s, so it did not cause the unit step. Its 327.58s “Run All Examples” figure includes both building and executing examples; the wrapper does not report them separately. Unlike the unit path, --no-parallel passes -j 1 to example compilation. The workflow also builds Blink once in quick mode and again among the debug examples, using separate build directories. The existing local follow-up below notes the loop-count discrepancy; it is not evidence that loops dominate hosted example time. Instrument example compile and execution separately before changing coverage.

    Recommendation on zccache/artifact caching: Do not upgrade as the immediate fix: the job already used zccache 1.14.10, the latest published release. Yes, pilot cross-run caching of compiler outputs with zccache's documented GitHub Actions integration or an equivalent restore/build/graceful-shutdown/save sequence. Use the Actions cache mechanism, not uploaded workflow artifacts, for repeat-run reuse. Scope keys to Linux architecture, Clang/toolchain, zccache version and debug/sanitizer flags; seed reusable cache from the trusted default branch and let PR jobs restore it without flooding the cache with per-PR saves. Bound size and measure cache transfer overhead. Compare cold and warm runs of the same revision: hit rate, compile/link time, total wall time, cache size, and all 310 test results. Avoid caching complete Meson build trees or test binaries. No same-revision warm baseline exists yet, so a speedup is a hypothesis to validate, not a measured result.

  3. zackees commented on Sep 23, 2026

    @zackees
    MemberAuthor

    Repeat evidence: the Linux unit job on merged #4533 (https://github.com/FastLED/FastLED/actions/runs/35820465933/job/107051064528) passed but took 26m25s. This again was the unit-only workflow; its long Run All Unit Tests step was the last gate after all other PR checks finished. The #4533 local full C++ run passed quickly on a warm build, while a separate cold worktree showed multi-second per-test linking. Example loop count cannot explain this unit job, but the example workflow remains a separate measurement target under this issue.

  4. zackees commented on Sep 23, 2026

    @zackees
    MemberAuthor

    Linker A/B follow-up (local Linux x86-64, 2026-09-22): FastLED's Meson native tests explicitly use -fuse-ld=lld and build one shared library per unit test. I replayed one representative sanitizer-enabled test-DLL link (four test objects plus FastLED shared library, same Clang 21 driver/flags, output in /tmp) five times per linker, alternating LLD 21.1.8, mold, and upstream Wild 0.10.0. Raw driver wall times: LLD 0.04-0.05 s, mold 0.07-0.09 s, Wild 0.02-0.03 s. The Wild output identifies itself in its ELF .comment; all three links succeeded. Three isolated zccache-wrapped LLD links took 0.08-0.22 s. This is a tiny single-module warm-local benchmark, not a hosted cold-burst result or full functional validation of Wild. Even a 20 ms saving over roughly 310 DLLs would account for only about 6 seconds, not the cited 326.91 s linking phase. Prioritize tracing concurrent link scheduling, zccache daemon queue/IPC/materialization, and CPU/memory pressure before switching the CI linker. Wild is Linux ELF-only, so macOS/Windows retain LLD. The zackees/wild fork adds full-LTO/debug-link optimizations (PR #5), while this debug test path does not use LTO; upstream Wild is the cleaner candidate for a controlled Linux pilot. A CI A/B should compare cold debug full-suite link phase, peak RSS, correctness and stability, with the same runner/toolchain and bounded job count.

  5. zackees commented on Sep 24, 2026

    @zackees
    MemberAuthor

    Follow-up on example linking and post-link deployment (PR #4552):\n\n- Linux example jobs already install upstream Wild 0.10.0 through the shared example-test template. The hosted CompileTests run at https://github.com/FastLED/FastLED/actions/runs/35949930550/job/107476064349 shows FASTLED_NATIVE_LINKER exported to Wild and both FastLED/core and the example compile-test runner link commands using --ld-path=. The nightly Linux example workflow uses the same template.\n- For the 95-example native corpus, the generated Blink example shared-library link also uses that Wild path. The regular PR example job exercises CompileTests, not all 95 examples; the full corpus was exercised locally.\n- Separate issue: zccache previously set ZCCACHE_LINK_DEPLOY_CMD=clang-tool-chain-libdeploy on Linux and macOS, launching a Python post-link deploy process on each cache-miss link even though runtime DLL deployment is only required on Windows. PR #4552 now enables that hook and --deploy-dependencies only on Windows. This includes example links: Linux and macOS example builds no longer receive the post-link injection, while Windows keeps its DLL deployment behavior.\n- Controlled local full debug-thin runs after disabling Unix deployment passed 311 units and 95 examples: LLD 84.98s versus Wild 77.16s, both from linker-switch relinks with compiled objects retained. Earlier Linux LLD with deployment enabled took 442.95s. The deployment hook is the dominant local regression; these are not yet hosted cold-build A/B results. Fresh hosted validation of the updated PR is pending.

  6. zackees commented on Sep 24, 2026

    @zackees
    MemberAuthor

    Post-merge validation of the Linux linker/deployment change (merged #4552, test-only follow-up #4556):\n\n- Full hosted Linux debug-thin unit run https://github.com/FastLED/FastLED/actions/runs/35953451178/job/107486678051 passed 311/311 units. The C++ test command took 535.65s: Meson 4.44s, compilation 447.29s (core+PCH 151.65s, reported test linking 81.48s), execution 82.82s. Its full Python step also passed. zccache remained cold at 0/346 hits.\n- The previous hosted Wild run before removing the Unix deployment hook https://github.com/FastLED/FastLED/actions/runs/35950405782 took 747.95s for the same 311-unit debug-thin step, with 306.40s reported test linking and 82.44s execution. The new step is 212.30s (28.4%) faster; reported linking is 224.92s (73.4%) lower. These runs are on nearby, not identical, revisions/runners, so treat this as strong corroboration rather than a strict hosted A/B.\n- Full hosted Linux Nightly example run https://github.com/FastLED/FastLED/actions/runs/35952787758/job/107484695988 passed 95/95 examples in 248.19s. Its Blink example link command used upstream Wild, and no --deploy-dependencies flag. The earlier debug-thin Nightly run https://github.com/FastLED/FastLED/actions/runs/35910439622/job/107348619947 took 309.84s; the new run is 61.65s (19.9%) faster, again across different revisions/runners.\n- Controlled local same-object relinks with Unix deployment disabled passed 311 units and 95 examples: LLD 84.98s, Wild 77.16s. Most of the larger hosted gain is consistent with removing the Python post-link deployment process on Linux; the isolated Wild gain is smaller.\n- The first full post-merge unit dispatch was blocked before C++ by a Python cache test that inherited FASTLED_NATIVE_LINKER. PR #4556 isolates that test environment, verifies the linker override bypasses cache, and the subsequent exact-head hosted full job passed. No production linker behavior changed in that follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions