How to Reduce Code Cycle Time with Feature Flags
Tags: code, industrytrends, engineering
Published: 2021-04-29 19:10:33

---
title: How to Reduce Code Cycle Time with Feature Flags
published: true
date: 2021-04-29 13:05:00 UTC
tags: Code,IndustryTrends,engineering
canonical_url: https://www.split.io/blog/reduce-code-cycle-time-feature-flags/
---

By Pato Echagüe

Companies that invest constantly in tools to help engineering teams reduce the cycle time show a higher degree of employee satisfaction, leading to less employee frustration and higher retention over time. Sounds great, right? 

We also know that the most elite engineering organizations are able to move code from being written and committed and into production in less than one day. The next tier down, the highly successful engineering orgs have cycle time at one week or less. And the rest follow. Based on this classification, how do you rank your team?

This data comes from both [DORA](https://www.devops-research.com/quickcheck.html) research and a joint [webinar](https://www.youtube.com/watch?v=zQqYU4oYZA0) we recently conducted with [Bryan Helmkamp](https://www.linkedin.com/in/bryanhelmkamp/) from [CodeClimate](https://codeclimate.com) in which we discussed one way to define development cycle time as well as tips on how to improve it. I was excited about this webinar as there is a strong correlation with how feature flags can help reduce the time of several phases of it.

Before we dig deeper on how to reduce cycle time, let’s talk about what it is. Brian defines cycle time as the amount of time spent between when code is committed and when it is shipped to production.

Bryan and team have an opinionated view on how to define the phases. They recommend you start measuring the code cycle time when the pull request is made and to treat the time more like a [Service Level Objective](https://www.atlassian.com/incident-management/kpis/sla-vs-slo-vs-sli) (SLO) where you measure 90th or 95th percentile, as opposed to just measuring averages.

I’ll go ahead and describe code cycle times below and provide my commentary regarding where feature flags can help decrease the time of some of the phases.

![](https://www.split.io/wp-content/uploads/2021/04/blog-cycle-time-inline-01-1024x600.png?width=700)

## Time to Open

Time to open measures the time from first commit to the time the pull request is opened. It accounts for the largest chunk of overall cycle time. Bryan mentioned that when people create smaller pull requests they tend to be picked up quicker, reviewed faster and deployed faster as well.  

### Tips to decrease time to open

- Reduce multitasking and limit work in progress. 
- Identify and limit rework
- Track and reduce pull request size

Here is where feature flags have a profound positive impact on cycle time. Why is that? Because when using feature flags, you separate a push from a release. And when you do that, engineers feel safer merging code and shipping it to production. The new code path is gated by a flag that is not yet visible to users. And the byproduct of that is smaller pull requests, faster time to review and shorter Time to Open cycle time.

## Time to First Review

This is the amount of time from when the pull request is opened to the time of first review. This is an indicator of team collaboration patterns in the organization, As we all know, slow reviews increase the amount of work-in-progress.

Feature flags again help to decrease this time by allowing engineers to create pull requests in small batches that in turn help reviewers review and approve outstanding pull requests faster.

Engineering leaders must make sure that coding cadence is not the only thing that gets rewarded. Code reviews have to be something that the leader rewards as well, given the implications to the cycle time and development cadence. 

Other investments you can make are in tooling and integrations (like Slack) to make sure people are aware there are pull requests ready to be reviewed and make collaboration more efficient. 

## Time to Approve

Time to approve refers to the time from the first review to when the pull request is ready to be merged.

This speaks to finding alignment around the desired state of the PR to be considered ready and must balance speed and thoroughness.

Things to look out for here include what percentage of comments imply actions. Driving this metric to any extreme is not good. You must seek a balance. Too many comments slow things down and too few can lead to defects.

Lastly, the number of review cycles is another metric to optimize. Too many back and forths leads to a decrease in cycle time. Bryan’s team found their sweet spot at four review cycles per PR.

## Time to Deploy

Time to deploy is the time from when the PR is ready to go until it is deployed to production.

You can decrease the time in this phase of the cycle time by investing in reliable Continuous Integration (CI) tools to increase people’s confidence in the deploy process. Usually when there is no investment in this area, as the code base grows people develop lack of confidence in the deployment due to the fear of breaking something. Automate as much as you can, such as testing and security checks (also known as shifting left). 

## Learn More About How Feature Flags Can Allow You to Release with Speed and Safety

Feature flags play an important role here and it is something Bryan calls out in his presentation. Code can arrive to production much faster and with lower friction when using feature flags (remember, a code push doesn’t imply a release). Now, this opens the question if there should be a fifth phase in the cycle time that includes time to release. What do you think?

If you’d like to learn more about DORA, the research organization mentioned in this post, check out their [website,](https://cloud.google.com/devops/#section-1) and their [survey data on high-performing companies](https://www.devops-research.com/quickcheck.html).

If you’re ready to get started with Split you can [sign up for our forever-free tier](https://www.split.io/signup/). If you’d like to learn more, check out these resources:

- [The Dos and Don’ts of Feature Flags](https://www.split.io/blog/dos-and-donts-of-feature-flags/)
- [Testing a Feature-Flagged Change](https://www.split.io/blog/testing-feature-flagged-change/)
- [Build a CD Pipeline in Java with Travis](https://www.split.io/blog/java-continuous-deployment-tutorial/)
- [A Simple Guide to A/B Testing](https://www.split.io/blog/a-simple-guide-to-a-b-testing/)
- [How to Implement Testing in Production](https://www.split.io/blog/how-to-implement-testing-in-production/)

If you’d like to catch our newest content right off the presses, we’d love to have you follow us on [Twitter](https://twitter.com/SplitSoftware), [YouTube](https://www.youtube.com/channel/UCrkFMZZY8cjmZyKzOVV245Q/videos), and [Facebook](https://www.facebook.com/splitsoftware)!