Skip to main content

A high-performance local compiler cache daemon

Project description

zccache

A blazing fast cpp compiler cache

New Project

Inspired by sccache, but optimized for local-first use with aggressive file metadata caching and filesystem watching.

Performance

Benchmark: 50 C++ files, warm cache

Scenario Bare Clang sccache zccache vs sccache vs bare clang
Single-file, Cold 10.336s 17.292s 11.489s 1.5x faster 0.9x
Single-file, Warm 10.141s 1.331s 0.031s 43x faster 324x faster
Multi-file, Cold 9.898s 9.906s 10.337s 1.0x faster 1.0x
Multi-file, Warm 10.422s 9.809s 0.023s 419x faster 446x faster

Cold = first compile (empty cache). Warm = median of 5 subsequent runs. Single-file = 50 sequential clang++ -c unit.cpp invocations. Multi-file = one clang++ -c *.cpp invocation. sccache cannot cache multi-file compilations — its "warm" multi-file time is a full recompile.

Run the benchmark yourself: uv run perf

Build system integration (ninja, meson, cmake, make)

zccache is a drop-in compiler wrapper. Point your build system's compiler at zccache <real-compiler> and it handles the rest:

# meson native file
[binaries]
c = ['zccache', '/usr/bin/clang']
cpp = ['zccache', '/usr/bin/clang++']
# CMake
set(CMAKE_C_COMPILER_LAUNCHER zccache)
set(CMAKE_CXX_COMPILER_LAUNCHER zccache)

The first build (cold cache) runs at near-bare speed. Subsequent rebuilds (ninja -t clean && ninja, or touching source files) serve cached artifacts via hardlinks in under a second.

Single-roundtrip IPC: In drop-in mode, zccache sends a single CompileEphemeral message that combines session creation, compilation, and session teardown — eliminating 2 of 3 IPC roundtrips per invocation.

Session stats: Track hit rates per-build with --stats:

eval $(zccache session-start --stats --log build.log)
export ZCCACHE_SESSION_ID=...
# ... build runs ...
zccache session-stats $ZCCACHE_SESSION_ID   # query mid-build
zccache session-end $ZCCACHE_SESSION_ID     # final stats

Persistent cache: Artifacts are stored in ~/.cache/zccache/artifacts/ (or %LOCALAPPDATA%\zccache\artifacts\ on Windows) and survive daemon restarts. No need to re-warm the cache after a reboot.

Multi-file compilation (fast path)

When a build system passes multiple source files to a single compiler invocation (e.g. gcc -c a.cpp b.cpp c.cpp -o ...), zccache treats this as a fast path:

  1. Each source file is checked against the cache in parallel.
  2. Cache hits are served immediately — their .o files are written from the cache.
  3. Remaining cache misses are batched into a single compiler process, preserving the compiler's own process-reuse and memory-sharing benefits.
  4. The outputs of the batched compilation are cached individually for future hits.

This hybrid approach means the first build populates the cache per-file, and subsequent builds serve as many files as possible from cache while still letting the compiler handle misses efficiently in bulk.

Recommendation: Configure your build system to pass multiple source files per compiler invocation whenever possible. This gives zccache the best opportunity to parallelize cache lookups and minimize compiler launches.

Concurrency

The daemon uses lock-free concurrent data structures (DashMap) for artifact and metadata lookups, so parallel compilation requests from multiple build workers never serialize on a global lock.

Status

Early development — architecture and scaffolding phase.

Goals

  • Extremely fast on local machines (daemon keeps caches warm)
  • Portable across Linux, macOS, and Windows
  • Correct under heavy parallel compilation (no stale cache hits)
  • Simple deployment (single binary)

Architecture

See docs/ARCHITECTURE.md for the full system design.

Key components

Crate Purpose
zccache-cli Command-line interface (zccache binary)
zccache-daemon Daemon process (IPC server, orchestration)
zccache-core Shared types, errors, config, path utilities
zccache-protocol IPC message types and serialization
zccache-ipc Transport layer (Unix sockets / named pipes)
zccache-hash blake3 hashing and cache key computation
zccache-fscache In-memory file metadata cache
zccache-artifact Disk-backed artifact store with redb index
zccache-watcher File watcher abstraction (notify backend)
zccache-compiler Compiler detection and argument parsing
zccache-test-support Test utilities and fixtures

Building

cargo build --workspace

Testing

cargo test --workspace

Documentation

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

zccache-1.0.20-py3-none-win_amd64.whl (2.3 MB view details)

Uploaded Python 3Windows x86-64

zccache-1.0.20-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

zccache-1.0.20-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

zccache-1.0.20-py3-none-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

zccache-1.0.20-py3-none-macosx_10_12_x86_64.whl (2.3 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file zccache-1.0.20-py3-none-win_amd64.whl.

File metadata

  • Download URL: zccache-1.0.20-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.11

File hashes

Hashes for zccache-1.0.20-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 192fb3ef43c54936381e6953d27387b5f840dacf8035c56fb8af3e6d85f851f5
MD5 6d47776ba81ebba02cb112f324715e9b
BLAKE2b-256 3a768bb3fd2177667af602e2d6497cca0a9d2601e0734f98a386c299bb9defe9

See more details on using hashes here.

File details

Details for the file zccache-1.0.20-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for zccache-1.0.20-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7ff1d830a454f7a09ce36ce4ad9d0eeeda0e2d0a2a740d4676b058e6784a7d7
MD5 ea041066920e44869ded5556333a2f9f
BLAKE2b-256 3563c3d5ec709fe5ab5e564486274c29a55085e3c2bf07f5a974877b00cbd26d

See more details on using hashes here.

File details

Details for the file zccache-1.0.20-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for zccache-1.0.20-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb2a9f099736eaae62c3c213de1ee3ae88623630b3f5e69fbdaf97ca8e5766fb
MD5 dac92fb42e748a8b4c4a28892e04909d
BLAKE2b-256 440e815ab29949f30bc6b46688172ae7687573275c34ecb3a7265c50810cfe14

See more details on using hashes here.

File details

Details for the file zccache-1.0.20-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for zccache-1.0.20-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 788aec7971a6674bfc82eb124cec587d9bc923bff5b2fe37d6eed6f2866cba39
MD5 f1be8df743ee1884ccb450470b0e5e72
BLAKE2b-256 4dcedb57c199ee66cb5bfedfcedca63af297c3af83ecdb418f2f4801d5348a34

See more details on using hashes here.

File details

Details for the file zccache-1.0.20-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for zccache-1.0.20-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c3aeba410b5131f5258eef74aeb3e482a1c25e38e3cff70a477c770ff3cf6d20
MD5 5b5e19e1b72e39b78b9a4d777ec83e41
BLAKE2b-256 2db6b71c65e0a3a9723feeb62a6bf51bfb41d9498c9991f81e04539d1316009c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page