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

Add pool of hashes for HMAC #44

Merged
merged 2 commits into from
May 9, 2020
Merged

Conversation

storozhukBM
Copy link
Contributor

@storozhukBM storozhukBM commented May 7, 2020

This is an experimental branch where we try to improve the performance of hsAlg hashers.

Current results:

name                 old time/op    new time/op    delta
HS/Sign-HS256-4        3.02µs ± 1%    2.80µs ± 5%   -7.30%  (p=0.000 n=10+10)
HS/Verify-HS256-4      1.53µs ± 2%    1.18µs ± 1%  -22.91%  (p=0.000 n=10+9)
HS/Sign-HS384-4        3.44µs ± 4%    2.81µs ± 4%  -18.39%  (p=0.000 n=10+9)
HS/Verify-HS384-4      1.81µs ± 1%    1.29µs ± 2%  -28.81%  (p=0.000 n=9+9)
HS/Sign-HS512-4        3.39µs ± 1%    2.87µs ± 4%  -15.24%  (p=0.000 n=9+10)
HS/Verify-HS512-4      1.86µs ± 5%    1.30µs ± 1%  -29.97%  (p=0.000 n=9+9)

name                 old alloc/op   new alloc/op   delta
HS/Sign-HS256-4        1.33kB ± 0%    0.85kB ± 0%  -36.14%  (p=0.000 n=10+10)
HS/Verify-HS256-4        512B ± 0%       32B ± 0%  -93.75%  (p=0.000 n=10+10)
HS/Sign-HS384-4        1.70kB ± 0%    0.90kB ± 0%  -47.17%  (p=0.000 n=10+10)
HS/Verify-HS384-4        848B ± 0%       48B ± 0%  -94.34%  (p=0.000 n=10+10)
HS/Sign-HS512-4        1.78kB ± 0%    0.98kB ± 0%  -45.05%  (p=0.000 n=10+10)
HS/Verify-HS512-4        864B ± 0%       64B ± 0%  -92.59%  (p=0.000 n=10+10)

name                 old allocs/op  new allocs/op  delta
HS/Sign-HS256-4          18.0 ± 0%      13.0 ± 0%  -27.78%  (p=0.000 n=10+10)
HS/Verify-HS256-4        6.00 ± 0%      1.00 ± 0%  -83.33%  (p=0.000 n=10+10)
HS/Sign-HS384-4          18.0 ± 0%      13.0 ± 0%  -27.78%  (p=0.000 n=10+10)
HS/Verify-HS384-4        6.00 ± 0%      1.00 ± 0%  -83.33%  (p=0.000 n=10+10)
HS/Sign-HS512-4          18.0 ± 0%      13.0 ± 0%  -27.78%  (p=0.000 n=10+10)
HS/Verify-HS512-4        6.00 ± 0%      1.00 ± 0%  -83.33%  (p=0.000 n=10+10)

@codecov
Copy link

codecov bot commented May 7, 2020

Codecov Report

Merging #44 into master will increase coverage by 0.24%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   85.58%   85.83%   +0.24%     
==========================================
  Files          12       12              
  Lines         458      466       +8     
==========================================
+ Hits          392      400       +8     
  Misses         39       39              
  Partials       27       27              
Impacted Files Coverage Δ
algo_hs.go 82.45% <100.00%> (+2.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d58f52...0867de5. Read the comment docs.

# Conflicts:
#	jwt_bench_test.go
@storozhukBM storozhukBM marked this pull request as ready for review May 9, 2020 11:38
Copy link
Member

@cristaloleg cristaloleg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@cristaloleg cristaloleg changed the title Added BenchmarkHS and first concept of pool for hashers Add pool of hashes for HMAC May 9, 2020
@cristaloleg cristaloleg merged commit 1b483c8 into cristalhq:master May 9, 2020
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.

2 participants