DEV Community

Cover image for Improve your codebase
dejanualex for AWS Community Builders

Posted on • Edited on

Improve your codebase

Find your most expensive lines of code in your codebase with AWS Code Guru in a matter of minutes.

In today's world in which performance is a make-or-break factor and the focus is on minimizing costs. A good investment in your codebase is Amazon CodeGuru which will speed up and optimize your development process.

At the first glance, the latter might seem very enterprise oriented, but actually, you can leverage AWS CodeGuru in your personal projects.

What is Amazon CodeGuru?

Amazon CodeGuru is a machine-learning-powered solution for automating performance reviews and improving application performance. It does this by acting both on your code repositories and actual applications.

Amazon CodeGuru is comprised of two services: CoduGuru Reviewer and CodeGuru Profiler

  • CodeGuru Profiler visualizes your application performance, showing you the methods that take the most time and CPU capacity to execute.

  • CodeGuru Reviewer is what listens for pull requests in a repository and reviews code changes. When the Reviewer is associated with a repository, it will attempt to provide recommendations to help improve Java and Python code.

How it works

Improve your codebase in a matter of minutes!

Basically, you just need to associate your repo with Amazon CodeGuru, and the nice part is that it supports source providers like GitHub or Bitbucket.

Supported Repositories

To get started I'll onboard my Github repository to do a full analysis, it may take 30 seconds to associate the repository, and 5-10 minutes to create full repository analysis.

CodeGuru Service

After the analysis is done, you're going to find the recommendations for the specified code analysis.

CodeGuru Analysis

And literally that's it, you can check the status of the code analysis in AWS Console -> CodeGuru -> Code reviews.

CodeGuru analysis

CodeGuru analysis2

Next I'll check the Pull Request code review, for this I'll associate my CodeCommit repository, it can take a couple of minutes to fully associate, but you can verify the status under the Settings of the repository, Amazon CodeGuru Reviewer tab.

CodeGuru status

When you submit a pull request to a CodeGuru associated code repository, the Reviewer will peruse the changes in the pull request and make recommendations based on its own analysis of millions of lines of external code, as comments on your file changes.

For a Python codebase, you're going to see something like this and also a very useful feature is that you're going to have a link to PEP.

CodeGuru pull-request 1

CodeGuru Reviewer generates suggestions in its reviews as comments in pull requests.

CodeGuru pull-request 2

From the price point of view, you can get started with Amazon CodeGuru Reviewer at no cost, the Free Tier lasts 90 days for up to 100K lines of code in onboarded repositories per AWS account. When the 90-day Free Tier expires or your repository size exceeds 100K lines of code, you will pay standard pricing rates based on the repository size.

AWS CodeGuru Pricing

Additionally, if you deploy CodeGuru as an agent in your application, over time it will make observations and recommendations to help you find and fix code issues such as performance leaks, wasted CPU cycles, and more.

Top comments (0)