Skip to content

Conversation

@eleanorTurintech
Copy link
Contributor

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)

@boring-cyborg
Copy link

boring-cyborg bot commented May 6, 2024

Thanks for opening this pull request! It might take a while before we look at it, so don't worry if there seems to be no feedback. We'll get to it.

@CLAassistant
Copy link

CLAassistant commented May 6, 2024

CLA assistant check
All committers have signed the CLA.

// < W(k) | P(j+1)/P(n) > =
// = SR(j+1) a(j+1,k) A(j+1) / P(n) + SR(j+1) < W(k) | A(j+1)/P(n) >
Real annuity = cs.coterminalSwapAnnuity(numberOfRates_,j+1);
Real annuity = annuities[j+1];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the same vector annuities be used also in the other loop ~20 lines below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I'll make that change too, thanks for pointing it out. In fact the quantitative results stated above were including this change, but I forgot to add it when making the final PR.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks.

@eleanorTurintech eleanorTurintech force-pushed the feature/smmdrift-calculator-performance branch from 5f3b8e0 to 3dabf86 Compare May 7, 2024 17:20
@lballabio lballabio added this to the Release 1.35 milestone May 9, 2024
@coveralls
Copy link

Coverage Status

coverage: 72.497% (+0.001%) from 72.496%
when pulling 3dabf86 on turintech:feature/smmdrift-calculator-performance
into 41b7ddc on lballabio:master.

@lballabio lballabio merged commit 40c6e77 into lballabio:master May 9, 2024
@boring-cyborg
Copy link

boring-cyborg bot commented May 9, 2024

Congratulations on your first merged pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants