[DOC, FEATURE] Improve dna4 complement performance and add documentation. #3026
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportBase: 98.24% // Head: 98.25% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #3026 +/- ##
=======================================
Coverage 98.24% 98.25%
=======================================
Files 275 276 +1
Lines 12318 12344 +26
=======================================
+ Hits 12102 12128 +26
Misses 216 216
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
18d7fe6
to
e9e2d06
Compare
I played around a bit: https://quick-bench.com/q/RtiW9XqNDG_O9BzGo8gUzKAZQNo constexpr uint8_t rank(char c) noexcept
{
uint8_t rank = static_cast<uint8_t>(c);
rank |= (rank & 0b0001'0000) >> 1;
rank += 1u;
rank >>= 2;
rank &= 0b0000'0011;
return rank;
}
rank |= (rank & 0b0001'0000) >> 1; // Set 4th bit to one if 5th bit is set (t and T)
rank += 1u; // Luckily flips the bits we need to flip
rank >>= 2; // Drop lowest 2 bits
rank &= 0b0000'0011; // Mask other bits
return rank; Works for both lower and upper case chars. I still need to test it with this PR and auto-vectorization. |
Still needs a few things to be fully dna4-compatible. As a side note, if we were to do the complement in constexpr simdifyable_dna4 & assign_char(char_type const c) noexcept
{
char_type const upper_char = c & 0b0101'1111; // to_upper
rank_type rank = (upper_char == 'A') * 3 + (upper_char == 'C') * 2 + (upper_char == 'G');
return assign_rank(rank);
}
|
f063e58
to
d4bfa5f
Compare
d4bfa5f
to
879fc8e
Compare
879fc8e
to
a29b5d9
Compare
cf7b40c
to
1031155
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-organized the files such that we have the simd_dna4
only in one place
allocator(allocator &&) = default; | ||
allocator & operator=(allocator &&) = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you delete these?
Their usage will lead to double free of forward
and reverse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? I get it for the copy ctor/assignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the default implementation of the move operator looks something like this:
allocator & operator=(allocator && other) {
forward = std::move(other.forward);
reverse = std::move(other.reverse);
}
If I have to allocator a1
and a2
and now move one into the other a1 = std::move(a2)
the original memory of a1.forward
and a1.reverse
is lost and not freed.
But when a1 and a2 go out of scope, they point to the same memory and there will be a double free on the same memory.
Co-authored-by: Enrico Seiler <enrico.seiler@hotmail.de>
Co-authored-by: Enrico Seiler <enrico.seiler@hotmail.de>
Co-authored-by: Enrico Seiler <enrico.seiler@hotmail.de>
Co-authored-by: Enrico Seiler <enrico.seiler@hotmail.de>
1031155
to
68c7bd4
Compare
(Aims to) Resolves #1970