Skip to content

perf(zccache) Phase 2: route per-compile dispatch through embedded ZccacheService #791

Description

@zackees

Sub-issue of #789. Depends on Phase 1.

Scope

With FBUILD_ZCCACHE_EMBEDDED=1, every per-TU compile goes through
ZccacheService::compile(...) directly instead of zccache wrap … child
processes. Wrapper path remains intact for default builds.

Deliverables

  • New embedded dispatch path in compile_many.rs / compile_exec.rs (or
    the equivalent call site under fbuild-build) selected by the
    CompileBackend enum landed in Phase 1.
  • Preserve cache-key compatibility: the wrapper-mode helpers
    (compile_cwd_from_output, normalize_flags_for_compile_cwd,
    path_arg_for_compile_cwd, UNC \?\ stripping) must be applied in
    the embedded path too — or moved inside the embedded service if it
    takes raw args. Goal: warm caches built by wrapper mode keep hitting
    after a flag flip.
  • Parallel-compile contract: confirm ZccacheService is Sync and
    produces no single-mutex bottleneck under the existing
    compile_many.rs fan-out. If it does, add a handle-pool layer.
  • ensure_running (the zccache start spawn at Daemon teardown hardening: process containment + socket lingering + console events #32) becomes a no-op in
    embedded mode — no child daemon needed.

Acceptance

  • With FBUILD_ZCCACHE_EMBEDDED=1, building tests/platform/uno
    produces a hot cache on rebuild and no zccache.exe child process
    is spawned
    (verified via process snapshot inside the test).
  • Wrapped vs embedded produce byte-identical object files for
    tests/platform/uno + tests/platform/esp32dev, or the diff is
    explained and documented.
  • Cold + warm wall-clock timings published in the PR for both
    platforms — quantifies the wrapper-spawn overhead this removes.
  • compile_many.rs parallelism unchanged: same -j scaling under
    embedded as under wrapped.
  • All existing zccache.rs tests still pass under wrapped mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions