-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use lookup table for hashing to boost perf #2
Conversation
This is awesome!
Since this is a small project, it's easier to test new crates (like criterion), so I'm pretty happy I spent some time writing the basic implementation (and already got two PRs, yay!) |
Thanks! This was mostly a not-serious "do lookup tables improve perf?" PR (I was really hoping LLVM would be smart here, but it looks like lookup tables are still best). I can definitely fix up to use |
Okay, I did a rewrite using The one, minor issue is that perf regresses slightly from the precomputed lookup above:
I think this is probably good to merge as is, but it would be nice to use a |
For ref, this is the numbers I see with the C++ ntHash:
(code in https://github.com/luizirber/nthash_perf) So, I'm fine with merging this with |
@bovee @luizirber just in case y'all are interested: I saw this PR and was also surprised that rust/LLVM wasn't generating optimal code for such a simple Summary:
|
@lynaghk this is really interesting and much stranger than I thought when I threw together this PR; thanks for writing it up! |
@lynaghk thank you for showing up and sharing your thoughful post! That's an amazing deep dive into the problem! (quick nitpick: the date in your post is "2018/01/22", and I was thinking "I don't think nthash is that old!" =P) |
Good eye Luiz, just fixed that date = ) Thanks
…On Wed, Jan 23, 2019 at 11:06 AM Luiz Irber ***@***.***> wrote:
@lynaghk <https://github.com/lynaghk> thank you for showing up and
sharing your thoughful post! That's an amazing deep dive into the problem!
(quick nitpick: the date in your post is "2018/01/22", and I was thinking
"I don't think nthash is that old!" =P)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJBz1fw-zjPuCMrQbSdltY0BzJLNXiiks5vGLLIgaJpZM4WuSce>
.
--
Kevin Lynagh
*https://kevinlynagh.com <https://kevinlynagh.com>*1.888.502.1042
|
Just for completeness, that is only a half-truth. The bigger problem is that the match statement gets compiled into a number of cmp/jmps which the CPU has a hard time predicting. The constant rollbacks stall execution. |
Inspired by this comment. It's kind of gross and doesn't
panic!
on a non-ACGTN nucleotide, but it does give a fairly substantial speed-up.Two notes:
panic!
/non-nucleotide check?const fn
; I'm not sure what the current status of those is though.Also, I really love the
bench
library you're using here: