Best practices for reducing cycle time
Tags: productivity, datascience, performance, management
Published: 2022-08-24 10:20:00

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Cycle time is an interesting metric you should use to evaluate your team’s quality and overall efficiency of your <a href="https://blog.codacy.com/the-essential-engineering-metrics-to-accelerate-software-delivery/" target="_blank" rel="noreferrer noopener">Engineering performance</a>. In a nutshell, it measures the time it takes for your team to complete work items once they begin working on them.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">To achieve Elite performance, you should actively work on reducing your cycle time. Since it represents the different phases of the delivery process, from code to production, you can focus on its four main components: coding time, PR pickup time, PR review time, and deployment time.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">In this article, we’ll look at ways to reduce your overall cycle time by improving each of these four components. Let’s dive in!</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1><strong>Coding time</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2><strong>What is coding time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">You’ve probably had this issue at least once as a developer or a team lead: it’s just taking too long to write code! Until you have the code written, it can’t be reviewed, iterated upon, and merged into production.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Coding time</strong> measures the time it takes from the first commit made to a branch until a pull request is submitted. We can correlate short coding time to low work in progress, small PR size, and clear requirements.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Keeping coding time under control is fundamental to improving your software development process. By looking at branches where coding time is pushing your limits, you can guarantee that your overall coding time stays under control.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>What causes high coding time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li><strong>The task is too big.</strong> This is probably the most common reason developers spend too much time coding one task; it is simply too large.</li><li><strong>The task is too difficult.</strong> Sometimes, a task can turn out to be harder than expected. For example, maybe the problem wasn’t completely understood in the first place, or several unknown variables were only later discovered, making the project bigger than anticipated.</li><li><strong>The task is languishing.</strong> In this case, the coding time is taking longer than expected because the developer started working but then dropped the task for a long time. Most likely, the developer turned to other tasks based on new priorities.</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2><strong>How to reduce coding time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">The best thing you can do to reduce coding time is to educate your team on the need to divide the work into small, manageable pieces. This will improve the overall coding time and positively affect PR times, where the commits get reviewed faster.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1><strong>PR pickup time</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2><strong>What is PR pickup time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">You’ve worked hard on a piece of code and finally finished it. You then create a PR and wait for the review, but nothing happens. Your team didn’t notice your pull request, even if you assigned the PR to someone.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>PR pickup time</strong> measures the time it takes from when a pull request is issued until someone starts to review it. Low PR pickup time represents strong teamwork and a healthy review process.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Long PR pickup time, on the other hand, is frustrating. Code with a long delay between PR creation and review was just sitting there when it could have been adding value to your customers.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>What causes high PR pickup time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li><strong>The team doesn’t know that the PR exists. </strong>PRs can easily go unnoticed or be forgotten. For example, a developer might not assign the PR to anyone, or the reviewer may forget about the request due to other work they have.</li><li><strong>The team is too busy. </strong>Developers have enough work they need to get done. Sometimes it’s challenging to find the time to do reviews, and developers put them off due to other priorities.</li><li><strong>The PR is too big. </strong>A big PR suggests lots of changes and complexity. Reviewers know it will take a lot of time, so they keep putting it off until they have a block of interrupted time to work through it. Unfortunately, this can mean a PR is being pushed forward for weeks.</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2><strong>How to reduce PR pickup time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>Use automated notifications to inform developers about PRs they need to review.</li><li>Monitor the amount of work each team member has taken. Of course, you should split the work equitably among team members, and no one should be overworking. This helps ensure everyone has time to perform reviews and optimizes overall development speed.</li><li>Reduce PRs and keep them small so that developers can review them quickly. PRs that developers can check at a glance can have near-immediate pickup times, while bigger PRs can take days or weeks to get picked up.</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":1} -->
<h1><strong>PR review time</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2><strong>What is PR review time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Before merging a PR into the source code, you need to review it to find issues and ensure that it follows your team’s coding style and standards. A developer starts a review, but they’re then pulled into another task and forget about the review altogether. As a result, the code just sits there, doing nothing.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>PR review time</strong> measures the time it takes to complete a code review and get a PR merged. Low PR review time represents strong teamwork and a healthy review process.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>What causes a high PR review time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li><strong>The PR is too big.</strong> Developers are reluctant to review big PRs, even after they have started since big PRs mean many code changes. Keeping track of all these different kinds of changes makes it harder to conduct effective code reviews.</li><li><strong>Too few people are assigned to do reviews. </strong>To maintain high-quality code, some teams limit the number of people who can review PRs, usually to the more senior developers. This is well-intentioned but can result in massive bottlenecks, with review requests piling up on just a few people.&nbsp;</li><li><strong>The team gets diverted into other work.</strong> Developers deprioritize reviews in favor of different work. If they discover a bug or receive a request for a high-priority feature appears, reviews get pushed back.</li><li><strong>The team forgets about the review. </strong>When developers start a review but then need to jump to another task, they commonly fail to come back to the review. A review can be “in progress” for days or weeks if there is no notification mechanism.</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2><strong>How to reduce PR review time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>Commit small, commit often. The more precisely you scope a PR, the easier it is to review and the faster it can get into production.</li><li>Use the logic of pair programming in code reviews with senior and junior developers. This will help everyone broaden their knowledge of the code base, and the reviews will serve as learning tools where more junior developers can improve their skills.</li><li>Make sure your team understands the importance of code reviews and that they have enough time to perform them. You can help them to meet your expectations by introducing a standard <a href="https://go.codacy.com/code-reviews-essential-guide" target="_blank" rel="noreferrer noopener">code review checklist</a>.</li><li>Schedule automatic notifications to remind developers when they started working on a PR review but haven’t finished it after a couple of days.</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":1} -->
<h1><strong>Deployment time</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2><strong>What is deployment time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">You’ve written new code and created a PR, which is picked up and reviewed. You respond to comments, update the PR, and the PR gets approval to merge into production. But code still has to go through testing. Maybe your organization merges new code in batches every couple of days, or your team has been putting out fires, so they’re not releasing new code into production.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Deployment time</strong> measures the time from when a branch is merged to when the code is released. Low deployment time correlates to high deployment frequency.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">The longer it takes to deploy the code, the longer it will take you to retry failed deployments, recover from outages, and provide value to your customers.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>What causes high deployment time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li><strong>Personnel bottlenecks.</strong> To ensure that high-quality code gets merged into production, some teams only allow some developers to merge PRs. This is well-intentioned, but senior developers tend to get overburdened since they are more knowledgeable.&nbsp;</li><li><strong>Inefficient testing. </strong>Your test suite should be robust, comprehensive, and fast, so you can spend time writing code, not waiting for the tests to complete.</li><li><strong>Code changes are too big.</strong> Big tasks and PRs lengthen the coding time and discourage people from reviewing them because it takes a long time. They also cause long deployment time: they’re more likely to create bugs, so developers put off merging them.</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2><strong>How to reduce deployment time?</strong></h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>If a team member has taken on too much work, you must better distribute responsibilities within the team.</li><li>Create a fast and efficient testing suite.</li><li>Commit small. Small changes are much easier to understand; thus, pushing them live is much less scary.</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":1} -->
<h1><strong>Conclusion</strong></h1>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>There are hundreds of ways to reduce cycle time, and this article does not provide a comprehensive list. However, it can help you get started. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you’re looking for a solution to measure the Accelerate metrics, <a href="https://www.pulse.codacy.com/?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=reduce-cycle-time" target="_blank" rel="noreferrer noopener">Pulse</a> is the way to go.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":5538,"sizeSlug":"large","linkDestination":"none","tdCaptionAlign":"https://blog.codacy.com/wp-content/uploads/2022/04/Pulse-dashboard.png"} -->
<figure class="wp-block-image aligncenter size-large td-caption-align-https://blog.codacy.com/wp-content/uploads/2022/04/Pulse-dashboard.png"><img src="https://blog.codacy.com/wp-content/uploads/2022/04/Pulse-dashboard-1024x563.png" alt="Pulse dashboard" class="wp-image-5538"/><figcaption class="wp-element-caption">Pulse dashboard</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Pulse takes care of all the details to ensure your Accelerate metrics are accurate and reliable.  Pulse connects seamlessly with your GitHub, Jira, and PagerDuty to give you Accelerate and other Engineering metrics out-of-the-box. Your team only needs to focus on making informed decisions to improve your results.</p>
<!-- /wp:paragraph -->