Code Review Bottlenecks: Best Practices to Speed the Process
Lengthy code reviews are stalling innovation: Here are ways to relieve code review bottlenecks.
September 11, 2023
Code review can create bottlenecks in the software development process by inherently slowing down the progression of code toward production.
When a code change is submitted for review, it often ends up in a queue waiting for a reviewer's attention, leading to significant wait times.
This delay is exacerbated when there are multiple pull requests (PRs) awaiting review or when there are limited available reviewers.
The review process itself can further extend the wait, as it requires careful examination and feedback.
Related: Guide to Becoming a Software Developer
On average, code is stuck in review for five days (or a full workweek), creating significant dev bottlenecks, unhappy developers, and hits to the bottom line.
These were among the key results of a 26,000-engineer study by LinearB, which also found that process-related gaps are causing software delivery pipeline challenges.
LinearB
Sources of Bottlenecks
"Although code reviews are crucial for ensuring code quality, the associated wait times and review process can create bottlenecks that hinder the timely delivery of features to production," said Truong-An Thai, vice president of engineering for FloSports.
Bottlenecks in the code review process can stall innovation by delaying the release of new features to production, he said.
"This delay can result in reduced customer satisfaction, as customers may have to wait longer to receive updates or new functionalities," Thai said. "Additionally, the slowed pace of feature delivery hampers the speed of learning, as developers have fewer opportunities to receive feedback on their work and iterate on it."
Thai-FloSports
The overall impact is a diminished ability to deliver value to customers in a timely manner, which can hinder positive business outcomes and limit a company's ability to innovate and stay ahead in a competitive market.
Improving Code Review Efforts
Large, mature engineering organizations often have a platform engineering team that focuses on solving technical challenges for other developers inside the organization.
"If you have a platform engineering team, that's typically the best place to start with initiatives to improve your code review practices," said Dan Lines, co-founder and COO of LinearB.
If the organization doesn't have a platform engineering team, it's a good idea to designate someone as the developer experience lead to focus on tooling, practices, and strategies to improve developer productivity at the organization, he said.
Thai added that anyone who is part of the product delivery team is responsible for looking at methods to speed code review — this includes team leads, engineering managers, and technical program managers.
"Developers will feel more satisfied and productive if their PRs get approved faster and get out to production rather than waiting and context switching," he said.
Using Industry Benchmarks to Judge Performance
To effectively speed code review, businesses should benchmark themselves against industry standards to see how they stack up against other engineering organizations, according to Lines.
"Once you've identified weak points, you should set goals for your team around things like PR size, pickup and review time, and referencing project tracking tickets," he said. "This sets the standard so you can track your success."
Then users can implement customizable workflow automation tools that help achieve those goals by unblocking low-risk changes, building and identifying code experts to distribute the review process, providing context to speed up reviews, and notifying the team when things are at risk of falling behind.
Thai said making code reviews a top priority for the team is crucial, and automated alerts can be set up to increase awareness about pending code reviews.
Lines-LinearB
"Additionally, providing context on code reviews, such as estimated review time, lines of code involved, or areas with risky changes, can help developers make informed decisions about picking up reviews," he said.
In addition, setting team goals for timely PR pickups and review completions can motivate team members to be more responsive.
"Another key approach is to keep PR sizes small, making them easier and quicker to review," Thai said.
Finally, automating tasks such as code style and formatting checks using tools like linters can save time and ensure consistency, freeing reviewers to focus on more substantive aspects of the code.
AI an Emerging Tool to Alleviate Code Review Bottlenecks
From Thai's perspective, artificial intelligence can play a pivotal role in alleviating bottlenecks in code review by streamlining and automating the process.
"AI-driven tools can automatically approve PRs that are small or deemed low-risk, thus eliminating wait times for human reviewers in these cases," he explained. "AI can also identify the best reviewers for a particular PR based on their expertise and availability, and automatically request changes for issues such as API deprecations."
Related: AI-Assisted Coding: What Software Developers Need to Know
Unlike human reviewers, AI can conduct reviews at any time, leading to faster turnaround times, and AI's ability to consistently apply review standards can also result in more reliable and efficient reviews.
"Additionally, AI could help code reviewers maintain their flow state by queuing up related or highly relevant PRs for review," Thai said. "These AI-powered approaches can accelerate the review process, improve code quality, and ultimately help features reach production faster."
Lines agrees that AI tools have quickly changed the way problems get solved, and the code review process is no exception.
"Several tools have already popped up to apply LLM [large language model] solutions to evaluating and reviewing code," he noted. "On top of that, many other CI/CD tools have already implemented AI improvements for things like static analysis, security evaluations, and architectural concerns."
Continuous merge tooling can also be configured to identify and tag AI-written code, helping to create distinct, customized workflows to evaluate it, Lines said.
Improving Velocity, Maintaining Quality
Code reviews are now an integral part of work, and when these code reviews are done the right way, the organization get value, according to Thai.
"It helps in catching bugs, making sure code works correctly, catching basic security issues, sharing best practices, and ensuring higher code quality," he said.
With the industry talking a lot more about speeding up code reviews, setting team goals around reducing PR time, and teams putting more emphasis on improving velocity, organizations must remind themselves to not compromise on code review quality.
"This is why we want to balance all four DORA metrics including change failure rate — not just cycle time or frequency of deployments — when we look to optimize PR pickup time and review time," Thai said.
Lines said the industry has reached a point where code review times frequently cause the most significant delays in the software delivery process.
"As the software industry continues to mature and the code we write gets more complex, the challenges of code reviews aren't going to go away," he said. "It's important to address these risks sooner rather than later."
About the Author(s)
You May Also Like