Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline AncestralSequence::mlCharProbAt and AncestralSequence::mlCharProbAtF methods #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

althonos
Copy link

@althonos althonos commented Jun 9, 2022

Hi Ari!

I was exploring the PRANK code and doing some profiling to see if I could make it any faster. After profiling with Valgrind, I found that the AncestralSequence::mlCharProbAt was in a very hot path: on my example of 12 sequences, it was being called 3M times, with a total cycle count of 150M cycles, out of a total execution of 400M cycles.

However, all this function is doing is loading data from memory, so it's not really normal to take 50 cycles per fetch; besides, hiding it in a function prevents the CPU from pipelining load instructions when used inside of a loop. By inlining this one function, the same invokation of PRANK went from 400M cycles to 250M cycles.

In terms of timing, that's how it improved on my machine:
image

@althonos
Copy link
Author

Hi @ariloytynoja, I've seen you updated the repo recently, would you consider merging this PR as well?

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.

None yet

1 participant