Pre-computation of Annuities: The updated code introduces a pre-computation of annuities for all rates and stores them in a vector. This avoids repeated calls to cs.coterminalSwapAnnuity() within the nested loops, potentially reducing computational overhead and improving performance.
Corresponding unit test runs ~30% faster on a single processor (standard build, g++ 11.4.0)
coverage: 72.497% (+0.001%) from 72.496%
when pulling 3dabf86a30953dd7d5e6d5f7c344da1dd9790b20 on turintech:feature/smmdrift-calculator-performance
into 41b7ddc1bdf18c24a8e605578c11042e8e6c4f91 on lballabio:master.
Pre-computation of Annuities: The updated code introduces a pre-computation of annuities for all rates and stores them in a vector. This avoids repeated calls to
cs.coterminalSwapAnnuity()
within the nested loops, potentially reducing computational overhead and improving performance.Corresponding unit test runs ~30% faster on a single processor (standard build, g++ 11.4.0)