Code refactoring is a critical process in software development that involves restructuring existing code to enhance its clarity, maintainability, and, importantly, performance. In the ever-evolving landscape of technology, the integration of Artificial Intelligence technologies has become a transformative force in optimizing codebases. 

This synergy of code refactoring and AI enables developers to identify and address performance bottlenecks, streamline complex algorithms and improve overall system efficiency. By harnessing the power of AI, Holcim EMEA Digital Center teams can not only expedite the refactoring process but also unlock innovative solutions to elevate the performance of applications for our customers. 

Alberto Cárceles, CRM Functional Consultant on the Commercial & CRM Team at Holcim EMEA Digital Center, has been harnessing the potential of AI for practical applications for the last year. He shares with us how AI technologies are enhancing performance in the key process of code refactoring. 

Code refactoring: Increasing performance through AI technologies


Delivering the best application performance

We have always looked for ways to mitigate and possibly anticipate problems, as the performance of our solutions is a critical point of impact to our customers. Their experience and the availability of our applications have always been a priority. 

We discovered areas of improvement which could take fewer processing requirements from the system and still make the whole process work better. For better performance we worked on a large-scale code refactor within our Salesforce instance. In particular, we refactored the backend-side of the main sales process, based on an object called Offer. It is the primary source of deals for our business, managed as offers in Salesforce and synced as contracts in SAP. 

AI for code refactoring 

We designed a plan resulting in delivering a total of three refactor packages. These packages would be tested by multiple users, both internal & from the business, to ensure quality & reliability. For this job we worked with GitHub copilot, a brand-new AI tool that auto-completes code in the editor (IDE) where it’s installed.

GitHub Copilot substantially increased the amount of code we could ship in the refactor. This is clearly illustrated by the fact that the third package had almost as many refactored components as the previous two combined. We observed an increase in productivity of around 30-40% in terms of the time taken to complete a class or script.

Increasing performance

In total, we were able to refactor 35K lines of code. The results have been satisfactory on all levels: execution times have dropped as well as the total number of jobs, while throughput has actually increased.

Incidents have decreased significantly, and as a result, our colleagues from support have more time to provide further value in enhancing our solutions.

As an IT service center to our business, we are at the forefront of innovation for delivering the best service to our customers. With the rapid implementation of the latest technologies in the market like GitHub Copilot, we are rapidly evolving to harness the capabilities of AI in order to deliver the best performance in our digital solutions to our clients.