gitmyhub

sccache

Rust ★ 7.4k updated 1d ago

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.

A shared compilation cache tool from Mozilla that stores build results in the cloud so your whole team and CI servers skip recompiling unchanged files, supporting C, C++, Rust, and GPU compilers.

Rustsetup: moderatecomplexity 3/5

Sccache is a tool from Mozilla that speeds up software compilation by remembering the results of previous builds. When a developer compiles a program, each source file gets translated into machine code by a compiler. If the source file has not changed since the last build, there is no reason to redo that translation. Sccache sits in front of the compiler and checks a cache before doing any work: if it has seen that exact file with those exact settings before, it serves the cached result instead of calling the compiler.

What makes sccache unusual compared to older tools of this type is that the cache can live in the cloud, not just on the developer's own machine. It supports storing cached build results in Amazon S3, Google Cloud Storage, Azure Blob Storage, Redis, and several other backends. This means that an entire team working on the same codebase can share a single cache, so the first person to build a given file effectively does the work for everyone else. Subsequent builds on any team member's machine, or on a continuous integration server, skip the compilation entirely.

It supports a wide range of compilers, including the common C and C++ compilers on all major platforms, Rust, and GPU-specific compilers from NVIDIA and AMD. Using it requires minimal setup: you prefix your compile command with sccache, or set a single configuration variable to use it automatically with Rust's build tool.

Sccache also includes an optional distributed compilation mode, where build work can be spread across multiple machines on a network. This mode includes authentication and encrypted transport, which older distributed compilation tools typically lack.

The tool is available through most major package managers on macOS, Windows, and Linux, and as prebuilt binaries on the releases page.

Where it fits