← Back to Blog
How-To

Accelerate QuantLib 6-100× Easily

Step-by-step guide to accelerating QuantLib with AADC — less than 1% code changes, 6-100× performance improvement, full adjoint Greeks included.

Dmitri Goloubentsev
Dmitri Goloubentsev
· 1 min read
QuantLib AADC how-to integration guide performance Greeks

QuantLib is the most widely used open-source pricing library in quantitative finance. It covers fixed income, derivatives, credit, and FX with battle-tested implementations. But its design (deep inheritance hierarchies, virtual function dispatch, fine-grained object allocation) makes it slow for production workloads that require repricing thousands of trades against hundreds of scenarios.

The Integration: Less Than 1% Code Changes

AADC integrates with QuantLib through operator overloading. The process requires less than 1% code changes to the QuantLib codebase:

  1. Replace double with idouble (AADC’s active type) at the market data entry points
  2. Run the existing QuantLib pricing path once to record the computation graph
  3. Compile the recorded graph to a native kernel
  4. Evaluate the kernel with new market data inputs

The pricing logic, curve construction, and instrument definitions remain untouched. AADC records whatever QuantLib does internally (interpolation, bootstrapping, cashflow projection) without needing to understand it.

Performance: 6-100× Faster

The speedup depends on the complexity of the instrument and the size of the portfolio. Simple instruments (FX forwards, IRS) see 6-20× improvement. Complex instruments (swaptions, exotic structures) see 50-100× improvement. The gain increases with portfolio size because the compiled kernel amortizes its overhead across more evaluations.

Full adjoint Greeks are included at near-zero marginal cost. Instead of bumping each curve point and repricing (O(n) evaluations for n risk factors), one adjoint pass through the compiled kernel produces all sensitivities simultaneously.

The QuantBench repository on GitHub provides reproducible benchmarks and integration examples.

View the QuantBench repository on GitHub


Published by MatLogica. Implemented using AADC, a commercial adjoint AD compiler (matlogica.com).

Want to see these results on your own portfolio?

Get in Touch

Interested in these opportunities?

Let's arrange a free demo for you and your team.

Book a Demo