DEV Community

Cover image for Fast GitHub Actions runners: how to measure which one is faster for your workflow
dev-token
dev-token

Posted on

Fast GitHub Actions runners: how to measure which one is faster for your workflow

Which GitHub Actions runner is faster depends on where your job spends its time. A runner that wins a CPU benchmark can lose on a job that mostly waits on the network, the disk or the queue. A published benchmark tells you how the publisher's build behaved on that hardware.

Below: how a job's time splits up, the GitHub-hosted baseline, and a matrix workflow plus a short script that compares runners on your own build.

Where a job's time goes

Every job's wall-clock time splits into parts that respond to different things:

Part What it needs Faster runner helps?
Queue (job created to job started) A free runner. On GitHub-hosted runners this includes the VM starting Only if the provider has spare capacity
Set up job, action downloads, checkout Network to GitHub A little
Dependency install, cache restore Network, disk Sometimes
Compile CPU cores, single-core speed, memory Usually
Tests CPU, memory, sometimes disk Depends on parallelism
Docker builds Disk, layer cache, network Depends on caching
Artifact and cache upload Network A little

The job's started_at timestamp is set once a runner has picked it up, so on GitHub-hosted runners the VM boot sits in the queue part. If most of your job is npm ci against a cold cache, doubling the cores barely changes it.

The GitHub-hosted baseline

The same label gets different hardware depending on the repository (GitHub-hosted runners reference):

Label Public repos Private repos
ubuntu-latest 4 vCPU, 16 GB RAM 2 vCPU, 8 GB RAM
ubuntu-24.04-arm 4 vCPU, 16 GB RAM 2 vCPU, 8 GB RAM
windows-latest 4 vCPU, 16 GB RAM 2 vCPU, 8 GB RAM
macos-latest (M1) 3 vCPU, 7 GB RAM 3 vCPU, 7 GB RAM
macos-15-intel 4 vCPU, 14 GB RAM 4 vCPU, 14 GB RAM

Each standard runner has a 14 GB SSD. For the standard Linux and Windows labels, a benchmark someone ran on a public repo used twice the cores your private repo gets. macOS labels and ubuntu-slim get the same hardware in public and private repos.

Larger runners go up to 96 vCPU and 384 GB RAM on Linux and Windows x64, and 64 vCPU on arm64. macOS has a 12-core Intel macos-latest-large and a 5-core M2 macos-latest-xlarge (larger runners reference). They're only available on the GitHub Team and Enterprise Cloud plans (about larger runners). Third-party runner providers and your own self-hosted runners plug into the same runs-on line, so the method below works for all of them.

Since October 28, 2026, eligible 2-core and 4-core Linux jobs may run on AWS as well as Azure, with the same labels and workflow syntax (GitHub changelog). The changelog doesn't promise identical CPUs across the two, so the CPU model can differ between runs on one label. The benchmark below logs it for that reason.

Step 1: profile the job you already have

Before trying any new runner, find the slow steps. The jobs API returns start and end times for every step (workflow jobs API). This prints each step's duration for one run, slowest first:

gh api "repos/OWNER/REPO/actions/runs/RUN_ID/jobs?per_page=100" --jq '
  .jobs[] | .name as $job | .steps[]?
  | select(.started_at != null and .completed_at != null)
  | [$job, .name,
     ((.completed_at | fromdateiso8601) - (.started_at | fromdateiso8601))]
  | @tsv' | sort -t$'\t' -k3 -nr | head -15
Enter fullscreen mode Exit fullscreen mode

$'\t' is bash and zsh syntax, so run this from one of those shells, not plain sh. GitHub's timestamps look like 2026-12-02T13:32:10Z, with no fractional seconds, which is the format fromdateiso8601 expects. The ? and the null checks skip jobs and steps that never started. The API returns the latest attempt of each job by default.

Match each slow step to a row in the table above. If the top steps are compile and test, more or newer cores are worth testing. If they are dependency installs or Docker pulls, look at caching and network first, because a bigger VM will barely move them.

Step 2: run the same build on every candidate

Put the runners you want to compare in a matrix and run the same commit several times on each. A single run per runner tells you very little, because shared machines are noisy.

name: runner-benchmark
on: workflow_dispatch

jobs:
  bench:
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        runner: [ubuntu-24.04, ubuntu-24.04-arm, my-org-16-core]
        attempt: [1, 2, 3, 4, 5]
    runs-on: ${{ matrix.runner }}
    steps:
      - uses: actions/checkout@v6
      - name: Record hardware
        run: |
          nproc
          free -h
          df -h .
          lscpu | grep -E 'Model name|Architecture' || true
      - name: Build and test
        run: make test   # your real build command
Enter fullscreen mode Exit fullscreen mode

Why it looks like this:

  • my-org-16-core stands for whatever you're testing: a larger runner, a self-hosted label or a provider's label. Use the label exactly as you'd use it in production.
  • ubuntu-24.04 is pinned instead of ubuntu-latest, because ubuntu-latest moved to Ubuntu 26 in late 2026 (changelog). A pinned image keeps runs from different days comparable. Use whatever image your production jobs run on.
  • timeout-minutes stops a hung runner from burning hours. Set it to a few times your normal job length.
  • Record hardware writes what you actually got into the log. If two runs on the same label show different CPU models, that explains some of the spread. The commands are Linux-only, so drop or rewrite the step if you add macOS or Windows labels.
  • There's no max-parallel. Fifteen jobs fit under every plan's concurrency limit, and max-parallel would hold later matrix jobs back. The script below would then report that wait as queue time.
  • Keep Build and test identical to production, including cache steps. A benchmark without your cache measures a cold build you may never run.

Cold and warm caches

Don't clear your repository's caches to get a cold number, because that also wipes the caches your production workflows use. Give the benchmark its own cache key instead. In the benchmark's copy of your cache step, add a choice input to workflow_dispatch (say cache, with options cold and warm) and set the key like this:

key: bench-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache == 'cold' && github.run_id || 'warm' }}
Enter fullscreen mode Exit fullscreen mode

A cold dispatch gets a fresh key every run, so nothing restores. For warm, dispatch once to fill the bench- keys, then dispatch again and use the second run's numbers. All five attempts on a runner start together, so they miss or hit together. Keying on runner.os and runner.arch matters, since x64 and arm64 can't share a cache. Without it, arm64 jobs could restore files built for x64.

GitHub evicts cache entries not used in 7 days and has a default 10 GB limit per repository (dependency caching), so warm isn't guaranteed in production either.

Step 3: summarise the run

Save this as runner_bench.py. It reads job objects from the jobs API and prints, for each runner, the median queue time, median and worst job time, and the median time of the step you name:

import json, sys
from datetime import datetime
from statistics import median

def ts(s):
    return datetime.fromisoformat(s.replace("Z", "+00:00"))

def secs(a, b):
    return (ts(b) - ts(a)).total_seconds()

heavy = sys.argv[1] if len(sys.argv) > 1 else None
rows = {}
for line in sys.stdin:
    if not line.strip():
        continue
    job = json.loads(line)
    if job.get("conclusion") != "success" or not job.get("runner_name"):
        continue
    label = ",".join(job["labels"])
    r = rows.setdefault(label, {"queue": [], "total": [], "heavy": []})
    if job.get("created_at"):
        r["queue"].append(secs(job["created_at"], job["started_at"]))
    r["total"].append(secs(job["started_at"], job["completed_at"]))
    for step in job.get("steps") or []:
        if step["name"] == heavy and step.get("completed_at"):
            r["heavy"].append(secs(step["started_at"], step["completed_at"]))

def p50(xs):
    return f"{median(xs):.0f}s" if xs else "-"

print(f"{'runner':<28}{'runs':>5}{'queue p50':>11}{'job p50':>9}{'job max':>9}{'step p50':>10}")
for label, r in sorted(rows.items(), key=lambda kv: median(kv[1]["total"])):
    print(f"{label:<28}{len(r['total']):>5}{p50(r['queue']):>11}"
          f"{p50(r['total']):>9}{max(r['total']):>8.0f}s{p50(r['heavy']):>10}")
Enter fullscreen mode Exit fullscreen mode

Run it against the benchmark run:

gh api --paginate "repos/OWNER/REPO/actions/runs/RUN_ID/jobs?per_page=100" --jq '.jobs[]' \
  | python3 runner_bench.py "Build and test"
Enter fullscreen mode Exit fullscreen mode

The output looks something like this (made-up sample input, not a real measurement):

runner                       runs  queue p50  job p50  job max  step p50
my-org-16-core                  5         9s     150s     171s      125s
ubuntu-24.04-arm                5        27s     277s     304s      252s
ubuntu-24.04                    5        11s     311s     330s      286s
Enter fullscreen mode Exit fullscreen mode

Failed, cancelled and skipped jobs are left out, so a runner that couldn't build your project shows fewer runs. Rows are grouped by the labels in runs-on, which describe what you asked for. The Record hardware log shows what you got.

Step 4: read the numbers

Start with the medians, then look at the spread. If one runner's worst run is far above its median, that worst run is the one developers will remember waiting on.

Treat the queue column as a rough signal. Queue time in a one-off benchmark dispatch isn't production queue time, because it depends on the provider's capacity at that moment and on whatever else your organization was running. For the real number, run the same script over your production history:

gh run list --repo OWNER/REPO --workflow ci.yml --limit 50 --json databaseId --jq '.[].databaseId' \
  | while read -r id; do
      gh api "repos/OWNER/REPO/actions/runs/$id/jobs?per_page=100" --jq '.jobs[]'
    done | python3 runner_bench.py
Enter fullscreen mode Exit fullscreen mode

That measures created_at to started_at on the jobs your team actually waited for, at the hours they actually pushed.

Next, check how the heavy step scales. Going from a 2-vCPU private ubuntu-24.04 runner to an 8-vCPU one can cut a perfectly parallel step by at most three quarters. If it cut much less, the step isn't fully parallel. Look at the build tool's job count setting (for example make -j, --parallel or --max-workers) before paying for more cores.

Then work out cost per run. GitHub rounds each job's minutes up to the nearest whole minute (runner pricing). A 2-core Linux x64 minute is $0.006 and a 16-core one is $0.042, and the rates in between rise roughly with core count. So a bigger runner mostly buys time and rarely saves money. With the sample numbers above, the 2-core job rounds to 6 minutes (6 x $0.006 = $0.036) and the 16-core job to 3 minutes (3 x $0.042 = $0.126). Whether halving the wait is worth that is a question about your developers' time. Self-hosted and third-party runners are priced differently, so use each one's own rate.

Finally, watch architecture. arm64 runners need arm64 builds of your tools and containers, so a matrix run that fails on arm64 tells you what has to change before you could switch.

A few caveats

  • Five runs per runner is enough to spot large gaps and too few for small ones. If two runners land within a few percent of each other, treat them as equal and decide on queue time and cost.
  • Shared hardware varies by time of day. Spread runs across a working day if you can.
  • Larger runners are billed per minute in public repositories too.
  • The benchmark measures one commit. Re-run it after big dependency or toolchain changes, because the slow step can move.

Top comments (0)