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

Speedup expected_errors by using a lookup table #700

Merged
merged 2 commits into from Apr 28, 2023

Conversation

rhpvorderman
Copy link
Collaborator

Also includes a check if every phred score is in fact a valid phred score. By assigning the phreds to a uint8_t array, the quals[i] - base calculation is unsigned, and thus the result will always be positive. If the invalid character is a phred lower than 33, say 10, then it will map to 245. As a result we can check all phreds with only one check: are they higher than 93?

A lookup table is much faster than the expensive exponent calculations for floats. Especially since the lookup table will fit easily in L1-cache, the lookup time is at most ~3-4 clock cycles, which is hard to beat using arithmetic.

@marcelm marcelm merged commit 248afbe into marcelm:main Apr 28, 2023
15 checks passed
@marcelm
Copy link
Owner

marcelm commented Apr 28, 2023

Very nice, much appreciated! (as always)

@rhpvorderman rhpvorderman deleted the fasterexpectederrors branch April 28, 2023 11:14
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

2 participants