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

Use SIMD #1

Open
Sc00bz opened this issue Apr 13, 2020 · 1 comment
Open

Use SIMD #1

Sc00bz opened this issue Apr 13, 2020 · 1 comment

Comments

@Sc00bz
Copy link

Sc00bz commented Apr 13, 2020

Your benchmark numbers are too low because you don't use SIMD such as SSE2, AVX, AVX2, and AVX512. Your CPU "2019 Macbook Pro (2.6 GHz 6-Core Intel Core i7)" is likely a i7-8850H. If I didn't mess up because that's the only CPU I could find that matches those stats. A i7-8850H has AVX2 so your numbers should be about 7.6x higher with a correct implementation.

Note "When running on a single processor it took around 80 seconds to generate all of the proximity keys. When running on all CPUs (12) it takes around 20 seconds." means you messed up. First you should only run 6 threads because similar work loads when run on a hyperthreading CPU slows it down vs using correct core count. But likely your threading code is poor because 2/3 speed should not happen. It should be more like at least 80% speed with using all hyperthreading "cores" (ie 80/6/.8 or 16.7 seconds unless there is heavy rounding going on).

Oh right the average number of new cases for the last week is 82.1k vs 50k per day. Also it's 14 vs 10 days. So my guess for your laptop is 24 seconds for a single thread and 4.0 seconds for 6 threads. Ignoring 82.1k vs 50k and 14 vs 10 days it's 11 seconds for a single thread and 1.8 seconds for 6 threads. This all assumes that the current SHA256 code is optimal, but if not then it's less.

@fewstera
Copy link
Owner

Thank you for the response, I wasn't aware of SIMD, this is the response I was hoping for by publishing this repo.

My processor is an 'Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz', which appears to have AVX2 support. For a more accurate representation, I should probably be running these tests on a mobile rather than my laptop.

I tried a drop-in SIMD sha256 implementation (https://github.com/minio/sha256-simd), but this made a negligible difference, I believe this may be due to the HMAC function still being from the go standard library implementation.

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

No branches or pull requests

2 participants