Skip to content

Rust

Rust and RunsOn is a match made in heaven:

RustRunsOn
Has slow compilation timesProvides runners with at least 30% better CPU performance than GitHub
Builds and tests benefit heavily from multiple CPUsProvides a ton of different runners with various CPU/memory configs to optimize build speed
Caches are often gigantic and get invalidated quickly due to GitHub’s 10GB cache limitHas Magic Cache with unlimited size and faster restore/save via S3
Can be expensive to run on powerful machinesUses spot capacity for ~90% cost savings

Benchmarks

Lychee

Lychee ↗ is a fast, async, stream-based link checker written in Rust. It finds broken URLs and mail addresses inside Markdown, HTML, reStructuredText, websites and more.

It already has an optimized CI workflow, but due to the low speed of GitHub runners, switching to RunsOn still managed to provide at least 30% faster builds, while being ~90% cheaper.

lycheeverse/lychee

↓93% cost • ↓38% time
RunsOn 4 CPU
$0.007 3.8min
GitHub 4 CPU
$0.096 6.0min

lycheeverse/lychee

↓82% cost • ↓58% time
RunsOn 16 CPU
$0.017 2.5min
GitHub 4 CPU
$0.096 6.0min

Benchmarks show that even when switching to a much larger runner size (16 CPUs instead of 4), it is still ~80% cheaper than GitHub, while being more than 2x faster.

How to speed up your Rust builds

Once you have installed RunsOn in your AWS account, you can get all the speedups by adding two lines:

  1. Switch runs-on: definition to your runner specification (here: a 4 CPUs x64 Linux runner)
  2. Enable the Magic Cache by adding the label extras=s3-cache, and the runs-on/action@v1 action.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
jobs:
test:
runs-on: ubuntu-latest
runs-on: "runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/extras=s3-cache"
steps:
- uses: runs-on/action@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Compile
run: cargo check --locked
- name: Test
run: make test

Conclusion

Anyone still using the official GitHub Actions runners for their Rust builds is missing out, both in performance and cost.

RunsOn is the only all-in-one solution that can be full self-hosted in your own AWS account, and comes with up-to-date compatible runner images, transparent S3-based caching for unlimited size and very fast transfers, spot instances for 90% cost savings, and a ton of other features.

Get started now and get your Rust builds in GitHub Actions 10x cheaper and much faster with RunsOn.