rust-build-times

Diagnose and reduce slow Rust compilation times using cargo-timings, sccache, and linker configuration.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill rust-build-times-awfixers-stuff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-build-times
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/rust-build-times
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill rust-build-times-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers and CI engineers diagnose and reduce slow Rust compilation and linking times by identifying crate-level bottlenecks, inefficient linker choices, and suboptimal build configurations.

Core Features & Use Cases

  • Profiling with cargo-timings: Generate and interpret timing reports to find long sequential chains, slow crates, and proc-macro blockers.
  • Compilation caching with sccache: Configure sccache as the rustc wrapper for local development and CI to reuse previous compilations.
  • Faster dev codegen with Cranelift: Use the Cranelift backend for much faster development builds while keeping LLVM for release builds.
  • Workspace splitting and parallelism: Restructure monolithic crates into workspace members to increase parallel compilation.
  • LTO and codegen tuning: Balance thin LTO, fat LTO, and codegen-units for tradeoffs between link time and runtime performance.
  • Fast linkers: Recommend mold, lld, or cargo-zigbuild to dramatically reduce link time on large projects.
  • Quick example: For a CI-heavy repository, combine sccache, workspace splitting, and lto thin in release to minimize rebuilds while retaining good runtime performance.

Quick Start

Run cargo build --timings and open the generated timing HTML report to identify the slow crates and linking bottlenecks.

Frequently Asked Questions about rust-build-times

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I speed up slow Rust compilation times in my workspace?

To speed up slow Rust compilation, run cargo build --timings to identify bottleneck crates, then apply sccache for caching, split workspaces for parallelism, and switch to fast linkers like mold or lld.

How does the Cranelift backend improve Rust dev builds?

The Cranelift backend improves Rust dev builds by generating code significantly faster than LLVM. You can configure it for development builds while retaining LLVM for optimized release builds.

What is the best way to configure sccache for Rust CI pipelines?

The best way to configure sccache for Rust CI pipelines is to set it as the rustc wrapper. This allows the pipeline to reuse previous compilations and dramatically reduce rebuild latency.

Should I use thin LTO or fat LTO to balance Rust link time and runtime performance?

You should use thin LTO to balance Rust link time and runtime performance when you need faster builds, as fat LTO increases link time. Tuning codegen-units further adjusts this tradeoff.

Why does linking take so long in large Rust projects and how do I fix it?

Linking takes long in large Rust projects due to inefficient linker choices. Fix it by selecting fast linkers such as mold or lld, and tuning codegen units to reduce link latency.