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

Optimize NewSafeID using atomic #1035

Merged
merged 5 commits into from Feb 24, 2022
Merged

Commits on Feb 14, 2022

  1. messageID: add benchmark for NewSafeID

    Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
    zchee committed Feb 14, 2022
    Copy the full SHA
    c01cb38 View commit details
    Browse the repository at this point in the history
  2. messageID: optimize NewSafeID using atomic instead of mutex lock

    name                  old time/op    new time/op    delta
    NewSafeID-20            13.9ns ± 2%     7.5ns ± 1%  -46.16%  (p=0.008 n=5+5)
    NewSafeIDParallel-20    24.2ns ± 6%    22.1ns ± 1%   -9.06%  (p=0.008 n=5+5)
    
    name                  old alloc/op   new alloc/op   delta
    NewSafeID-20             0.00B          0.00B          ~     (all equal)
    NewSafeIDParallel-20     8.00B ± 0%     8.00B ± 0%     ~     (all equal)
    
    name                  old allocs/op  new allocs/op  delta
    NewSafeID-20              0.00           0.00          ~     (all equal)
    NewSafeIDParallel-20      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
    
    Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
    zchee committed Feb 14, 2022
    Copy the full SHA
    fb30ed3 View commit details
    Browse the repository at this point in the history
  3. messageID: add NewSafeID testcase

    Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
    zchee committed Feb 14, 2022
    Copy the full SHA
    1265b2e View commit details
    Browse the repository at this point in the history

Commits on Feb 24, 2022

  1. messageID: fix atomic operation suggested by brainexe

    name                  old time/op    new time/op    delta
    NewSafeID-20            7.60ns ± 1%    5.93ns ± 1%  -21.97%  (p=0.008 n=5+5)
    NewSafeIDParallel-20    21.0ns ± 1%    21.0ns ± 2%     ~     (p=0.952 n=5+5)
    
    name                  old alloc/op   new alloc/op   delta
    NewSafeID-20             0.00B          0.00B          ~     (all equal)
    NewSafeIDParallel-20     8.00B ± 0%     8.00B ± 0%     ~     (all equal)
    
    name                  old allocs/op  new allocs/op  delta
    NewSafeID-20              0.00           0.00          ~     (all equal)
    NewSafeIDParallel-20      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
    
    See also:
    - slack-go#1035 (review)
    
    Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
    zchee committed Feb 24, 2022
    Copy the full SHA
    daa4329 View commit details
    Browse the repository at this point in the history
  2. messageID: add documentation

    Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
    zchee committed Feb 24, 2022
    Copy the full SHA
    93ff3fb View commit details
    Browse the repository at this point in the history