From the course: Coding Smarter with JetBrains AI Assistant

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Improve code performance with AI suggestions

Improve code performance with AI suggestions

From the course: Coding Smarter with JetBrains AI Assistant

Improve code performance with AI suggestions

- [Instructor] As an engineer working on enterprise applications, I've seen how small performance improvements can make massive differences at scale. The JetBrains AI assistant can spot performance issues that might take us hours to identify manually. Let's take a look at an example. Here's a Java method that retrieves active customers. Let's ask the AI assistant to analyze this code. I'll select the method and choose the AI action to create a new chat using the selection. Then I'll follow it up with a prompt. How can I improve the performance of this method? The AI identifies several issues. We're fetching all customers from the database first. We're also using inefficient collection operations, and there's unnecessary object creation. With this, the AI suggests an improved version that leverages the existing findByActiveTrue method from the customer repository. It even explains why these changes improve the performance. For even better performance, it suggests using pagination…

Contents