Skip to content

Conversation

@jannotti
Copy link
Contributor

@jannotti jannotti commented Feb 5, 2025

Very small twekas while reading txHandler.go

This makes the saltedCache a tiny bit faster, and perform fewer allocs.

                                                  │ before.txt  │             after.txt              │
                                                  │   sec/op    │   sec/op     vs base               │
DigestCaches/data.digestCacheMaker/threads=1-10     720.7n ± 1%   723.9n ± 1%       ~ (p=0.210 n=10)
DigestCaches/data.saltedCacheMaker/threads=1-10     988.0n ± 1%   979.1n ± 1%  -0.90% (p=0.015 n=10)
DigestCaches/data.digestCacheMaker/threads=4-10     764.9n ± 1%   763.1n ± 1%       ~ (p=0.403 n=10)
DigestCaches/data.saltedCacheMaker/threads=4-10     1.319µ ± 0%   1.309µ ± 0%  -0.80% (p=0.000 n=10)
DigestCaches/data.digestCacheMaker/threads=16-10    997.5n ± 1%   994.1n ± 1%       ~ (p=0.305 n=10)
DigestCaches/data.saltedCacheMaker/threads=16-10    1.325µ ± 0%   1.309µ ± 1%  -1.21% (p=0.002 n=10)
DigestCaches/data.digestCacheMaker/threads=128-10   1.023µ ± 1%   1.020µ ± 0%       ~ (p=0.147 n=10)
DigestCaches/data.saltedCacheMaker/threads=128-10   1.356µ ± 0%   1.336µ ± 0%  -1.47% (p=0.000 n=10)
geomean                                             1.035µ        1.029µ       -0.61%

                                                  │ before.txt  │              after.txt               │
                                                  │    B/op     │    B/op     vs base                  │
DigestCaches/data.digestCacheMaker/threads=1-10     173.0 ±  2%   173.5 ± 0%        ~ (p=0.331 n=10)
DigestCaches/data.saltedCacheMaker/threads=1-10     171.0 ±  1%   138.0 ± 1%  -19.30% (p=0.000 n=10)
DigestCaches/data.digestCacheMaker/threads=4-10     184.0 ±  1%   184.0 ± 1%        ~ (p=0.914 n=10)
DigestCaches/data.saltedCacheMaker/threads=4-10     189.5 ±  1%   156.0 ± 1%  -17.68% (p=0.000 n=10)
DigestCaches/data.digestCacheMaker/threads=16-10    140.0 ± 11%   139.0 ± 1%        ~ (p=0.138 n=10)
DigestCaches/data.saltedCacheMaker/threads=16-10    189.5 ±  1%   156.0 ± 1%  -17.68% (p=0.000 n=10)
DigestCaches/data.digestCacheMaker/threads=128-10   156.0 ±  0%   156.0 ± 0%        ~ (p=1.000 n=10) ¹
DigestCaches/data.saltedCacheMaker/threads=128-10   193.5 ±  1%   159.0 ± 1%  -17.83% (p=0.000 n=10)
geomean                                             173.6         157.0        -9.56%
¹ all samples are equal

                                                  │ before.txt │              after.txt               │
                                                  │ allocs/op  │ allocs/op   vs base                  │
DigestCaches/data.digestCacheMaker/threads=1-10     1.000 ± 0%   1.000 ± 0%        ~ (p=1.000 n=10) ¹
DigestCaches/data.saltedCacheMaker/threads=1-10     2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
DigestCaches/data.digestCacheMaker/threads=4-10     1.000 ± 0%   1.000 ± 0%        ~ (p=1.000 n=10) ¹
DigestCaches/data.saltedCacheMaker/threads=4-10     2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
DigestCaches/data.digestCacheMaker/threads=16-10    1.000 ± 0%   1.000 ± 0%        ~ (p=1.000 n=10) ¹
DigestCaches/data.saltedCacheMaker/threads=16-10    2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
DigestCaches/data.digestCacheMaker/threads=128-10   1.000 ± 0%   1.000 ± 0%        ~ (p=1.000 n=10) ¹
DigestCaches/data.saltedCacheMaker/threads=128-10   2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
geomean                                             1.414        1.000       -29.29%

Summary

Test Plan

@jannotti jannotti requested a review from algorandskiy February 5, 2025 20:03
Very small twekas while reading txHandler.go
@jannotti jannotti changed the title Tiny speedup, less allocation Net: Tiny speedup, less allocation Feb 5, 2025
@jannotti jannotti self-assigned this Feb 5, 2025
@codecov
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 89.18919% with 4 lines in your changes missing coverage. Please review.

Project coverage is 51.78%. Comparing base (5bffa0e) to head (2eea1ec).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
data/txHandler.go 84.21% 2 Missing and 1 partial ⚠️
data/txDupCache.go 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6246      +/-   ##
==========================================
+ Coverage   51.76%   51.78%   +0.01%     
==========================================
  Files         644      644              
  Lines       86523    86517       -6     
==========================================
+ Hits        44790    44799       +9     
+ Misses      38864    38852      -12     
+ Partials     2869     2866       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

algorandskiy
algorandskiy previously approved these changes Feb 5, 2025
Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

*crypto.Digest to crypto.Digest looks surprising because that pointer's purpose in decreasing copying and allocations in early version of golang.

@jannotti jannotti requested a review from cce February 5, 2025 20:55
@algorandskiy algorandskiy merged commit 5f12e1a into algorand:master Feb 19, 2025
19 checks passed
@algorandskiy algorandskiy changed the title Net: Tiny speedup, less allocation network: tiny speedup, less allocation Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants