Unlock Cost Savings in Your Code
A single optimisation run costing about ten dollars produced a change QuantLib merged upstream. With Artemis AI, our GenAI-powered code optimisation platform, entire codebases can be quickly optimised for as little as $10, ensuring significant cost savings by avoiding the expenses associated with running inefficient code and spending valuable developer time to spot and fix code inefficiencies.
In this blog article, we will walk you through a recent project involving the QuantLib C++ library, where our engineer used Artemis AI to make the corresponding unit test about 30% faster. Our pull request was successfully implemented, meaning all financial firms leveraging QuantLib will benefit from this optimisation.
The change is seven lines in a library the industry actually runs, so every application built on QuantLib inherits it. What that is worth depends entirely on how much of your workload runs through this code path, which is why we benchmark on yours rather than extrapolating from ours.
Project Overview
QuantLib is an open-source library extensively used by financial institutions for quantitative finance tasks such as modelling, trading, and risk management. It powers a wide range of financial applications, including financial software platforms, research tools, and custom applications developed by companies.
The Challenge
In demanding domains like finance, slow and inefficient code within critical libraries like QuantLib can significantly impact application speed, analysis time, and ultimately, profitability and competitiveness for businesses.
The significant challenge lies not just in identifying that code is slow, but in pinpointing the specific lines or sections within a large codebase that are the actual source of performance bottlenecks. A single codebase like QuantLib can contain hundreds of thousands of lines. Manually identifying inefficiencies in such scale requires extensive profiling, tracing, and expert analysis to find the root cause.
Even for experienced performance engineers, this process of locating the specific problem area, developing potential optimized code, and then rigorously validating changes manually can take days or even weeks. This makes the task of code optimization a highly time-consuming and cumbersome process, diverting valuable developer resources.
Solution
With Artemis AI, one of our engineers optimised the performance of QuantLib in just five clicks and three easy steps:
- Code Analysis: Artemis AI's automated code analysis feature utilised large language models (LLMs), static analysis, and custom profilers like Intel Vtune, and identified multiple performance bottlenecks in the codebase. Our engineer completed this analysis in just 2 minutes.
- LLM-based Code Recommendations: Our engineer selected several LLMs (e.g. ArtemisLLM, GPT-4 Turbo, and Claude Opus) on the Artemis AI platform to generate over a hundred code recommendations that could potentially boost the performance of QuantLib. Artemis AI automatically scored and validated each recommendation, helping our engineer decide on the most effective and secure code changes.
- Code Optimisation: Artemis AI identified the most optimal combination of code changes from 700 options. The platform also provided performance metrics (e.g., runtime, CPU usage, memory usage) for informed decision-making in implementing the code changes.
The figures below compare the runtime of the original code version with the optimised version by Artemis AI.

*The merged pull request reports the corresponding unit test running ~30% faster on a single processor (standard build, g++ 11.4.0). Our own figure, 32.72%, is the average of 20 runs of that unit test; the scope in both cases is the unit test, not QuantLib as a whole. *Pull request https://github.com/lballabio/QuantLib/pull/1965
Benefits
-
Performance improvements: the corresponding unit test runs about 30% faster after a seven-line change, in code that every application built on QuantLib calls.
-
Developer Productivity: Developers are freed from weeks of painstaking manual profiling, bottleneck identification, fix hypothesizing, coding, and manual validation. They can now focus on higher-value tasks like innovation and feature development.
-
Business Impact: Faster analysis and responsiveness to financial market changes, substantial cloud cost savings, and reduced carbon emissions.
By leveraging Artemis AI, businesses can operate faster, greener, and more efficiently. Our platform's ability to quickly optimise codebases allows your developers to focus on innovation, boosting productivity and enhancing your competitive edge.
For more insights, check out our previous blog on how financial services can leverage Artemis AI for code upgrades and refactoring to achieve significant performance improvements and cost savings.




