Skip to main content

Cycle Time vs Lead Time

In the context of Pull Requests

Overview

Cycle Time (of Pull Requests) and Lead Time for Changes (referred to as Lead Time below) are key metrics used to measure engineering efficiency. While both are used in the context of Pull Requests, they represent different aspects of code delivery.

Definitions

The following definitions are set in the context of smooth-flow of Pull Requests.

Cycle Time

Cycle Time measures the time taken from when a pull request (PR) is opened to when it is merged. It provides insight into how efficiently code moves through the development process.

Lead Time

Lead Time for Changes measures the duration from the first commit to when the deployment is finished in production. It encompasses the entire journey from writing the first line of code to production release.

Key Differences

MetricDefinitionStart PointEnd PointFocus
Cycle TimeTime from PR open to PR mergePR openPR mergeEfficiency of development workflows
Lead Time for ChangesTime from first commit to deployment finished in productionFirst commitDeployment finished in productionOverall delivery speed

Why It Matters

  • Cycle Time helps teams optimize PR handling, reduce bottlenecks, and improve developer productivity.
  • Lead Time for Changes provides a broader view of code delivery efficiency and is a key DORA metric for measuring DevOps performance.

Why Coding Time Isn't Included

Cycle Time and Lead Time for Changes do not include actual coding time before a PR is opened. This is because:

  • Developers may work on multiple tasks before pushing code.
  • Coding time varies based on problem complexity and developer workflows.
  • These metrics focus on the efficiency of code moving through the pipeline rather than time spent writing code.
  • When exactly coding time for a PR started can very intrusive and may introduce privacy concerns.

Instead, Cycle Time and Lead Time measure how efficiently code progresses once it enters the PR and CI/CD workflow.

How MiddlewareHQ Measures These Metrics

MiddlewareHQ tracks both Cycle Time and Lead Time for Changes by analyzing Git and CI/CD events:

  • Cycle Time is calculated by measuring the duration between PR open and PR merge.
  • Lead Time for Changes considers the full journey, from the first commit to deployment completion, ensuring teams have visibility into overall delivery performance.

Example Calculations

MetricPR-101PR-102PR-103
First Commit DayDay 1Day 1Day 1
PR Open DayDay 2Day 1Day 2
PR Merge DayDay 3Day 3Day 2
Deployment Finished DayDay 5Day 3Day 3
Cycle Time (PR Open to Merge)1 day2 days<1 day
Lead Time (First Commit to Deployment)4 days2 days2 days

How to Improve These Metrics

Reducing Cycle Time:

  • Encourage smaller PRs to speed up reviews and merging.
  • Improve code review practices to avoid delays.
  • Automate CI/CD pipelines for faster testing and validation.
  • Identify if PRs are blocked by review bottlenecks, on Middleware.

Reducing Lead Time for Changes:

  • Improve deployment automation for smoother releases.
  • Minimize handoffs and streamline approval processes.
  • Optimize CI/CD pipelines for faster deployments.

By continuously monitoring and optimizing both Cycle Time and Lead Time for Changes, engineering teams can deliver high-quality software faster and more efficiently.