← back home · compare
rninja vs ccache
// Compiler-call wrapper cache
ccache is the long-standing default for caching C/C++ compiles: you invoke it as `ccache g++ ...` or set it as a compiler launcher, and it caches what that one compile produced. It is not a build tool and not a drop-in for ninja. rninja caches whole ninja actions, so it can skip an entire graph edge — not just the compiler half of it — and also improves scheduling. The two operate at different layers and can coexist: rninja runs the action, ccache handles the cc compile inside it.
| Feature | rninja | ccache | Advantage |
|---|---|---|---|
| Cache scope | Whole ninja action (compile, link, codegen) | Single C/C++ compiler invocation | rninja |
| Driver requirement | Anything that emits build.ninja | Wraps a C/C++ compiler (cc / c++ launcher) | ccache |
| Non-C/C++ actions (link, codegen, other langs) | Cached like any other action | Out of scope — C/C++ compiles only | rninja |
| Skipping a graph edge entirely | Yes (action-level hit) | No (still runs the compile driver) | rninja |
| Remote storage | Optional, async-nng endpoint | Local on-disk by default; secondary/remote backends in recent versions | comparable |
| Scheduler improvements | tokio async executor | Out of scope (depends on caller) | rninja |
| Can be combined | Yes — ccache inside an rninja action | Yes — ccache called by rninja | comparable |
| Drop-in for ninja | Yes | No (wraps compiler, not build tool) | rninja |
| Maturity / footprint | Newer, larger (Rust + cache deps) | Decades-old, tiny, ubiquitous in distros | ccache |
| License | MIT | GPL-3.0 | comparable |
// pick rninja when
- ▸Your build is already driven by ninja (or any generator that emits build.ninja)
- ▸You want to skip whole graph edges on a cache hit, not just the compile step inside them
- ▸You want caching for link, codegen, and non-C/C++ actions too, not only C/C++ compiles
- ▸You want the async scheduler improvements as well, not caching alone
// pick ccache when
- ▸Your build is not ninja-driven (make, autotools, cargo, a plain compiler wrapper)
- ▸You only need to cache C/C++ compiles and nothing else in your graph
- ▸You already run a ccache setup and the integration is settled
- ▸You want the smallest, most battle-tested tool with a tiny footprint
Still deciding?
The cheapest experiment is the side-by-side: time ccache target vs time rninja target on your real repo. Numbers settle the argument faster than marketing pages.