Skip to content

Refactor getZeroOrderHashes#85

Merged
pk910 merged 1 commit intopk910:masterfrom
Sahil-4555:optimize-getZeroOrderHashes
Mar 4, 2026
Merged

Refactor getZeroOrderHashes#85
pk910 merged 1 commit intopk910:masterfrom
Sahil-4555:optimize-getZeroOrderHashes

Conversation

@Sahil-4555
Copy link
Copy Markdown
Contributor

@Sahil-4555 Sahil-4555 commented Mar 2, 2026

goos: linux
goarch: amd64
pkg: github.com/pk910/dynamic-ssz/treeproof
cpu: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
                                                        │ old_bench.txt  │            new_bench.txt             │
                                                        │     sec/op     │    sec/op     vs base                │
TreeFromNodes/zero_limit_returns_empty_node-8               36.59n ±  8%   32.17n ±  4%  -12.07% (p=0.000 n=10)
TreeFromNodes/no_nodes_with_limit-8                       1000.30n ±  4%   89.90n ± 12%  -91.01% (p=0.000 n=10)
TreeFromNodes/single_node_with_limit_1-8                    2.331n ±  8%   2.303n ±  2%        ~ (p=0.143 n=10)
TreeFromNodes/single_node_with_limit_2-8                    611.6n ± 10%   116.5n ±  7%  -80.94% (p=0.000 n=10)
TreeFromNodes/two_nodes_with_limit_2-8                     558.40n ±  7%   83.56n ±  8%  -85.04% (p=0.000 n=10)
TreeFromNodes/non-power_of_2_limit-8                        26.27n ±  9%   28.30n ± 11%        ~ (p=0.353 n=10)
TreeFromNodes/four_nodes_with_limit_8-8                    1590.5n ±  4%   246.2n ±  9%  -84.52% (p=0.000 n=10)
TreeFromNodes/large_limit_with_few_nodes_does_not_OOM-8    10.465µ ±  6%   1.512µ ±  5%  -85.56% (p=0.000 n=10)
geomean                                                     244.4n         71.50n        -70.75%

                                                        │ old_bench.txt  │             new_bench.txt              │
                                                        │      B/op      │     B/op      vs base                  │
TreeFromNodes/zero_limit_returns_empty_node-8               48.00 ± 0%       48.00 ± 0%        ~ (p=1.000 n=10) ¹
TreeFromNodes/no_nodes_with_limit-8                         352.0 ± 0%       128.0 ± 0%  -63.64% (p=0.000 n=10)
TreeFromNodes/single_node_with_limit_1-8                    0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
TreeFromNodes/single_node_with_limit_2-8                    272.0 ± 0%       144.0 ± 0%  -47.06% (p=0.000 n=10)
TreeFromNodes/two_nodes_with_limit_2-8                     224.00 ± 0%       96.00 ± 0%  -57.14% (p=0.000 n=10)
TreeFromNodes/non-power_of_2_limit-8                        16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
TreeFromNodes/four_nodes_with_limit_8-8                     656.0 ± 0%       336.0 ± 0%  -48.78% (p=0.000 n=10)
TreeFromNodes/large_limit_with_few_nodes_does_not_OOM-8   4.234Ki ± 0%     2.328Ki ± 0%  -45.02% (p=0.000 n=10)
geomean                                                                ²                 -37.52%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                                        │ old_bench.txt │            new_bench.txt             │
                                                        │   allocs/op   │ allocs/op   vs base                  │
TreeFromNodes/zero_limit_returns_empty_node-8              1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
TreeFromNodes/no_nodes_with_limit-8                        7.000 ± 0%     2.000 ± 0%  -71.43% (p=0.000 n=10)
TreeFromNodes/single_node_with_limit_1-8                   0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
TreeFromNodes/single_node_with_limit_2-8                   6.000 ± 0%     3.000 ± 0%  -50.00% (p=0.000 n=10)
TreeFromNodes/two_nodes_with_limit_2-8                     5.000 ± 0%     2.000 ± 0%  -60.00% (p=0.000 n=10)
TreeFromNodes/non-power_of_2_limit-8                       1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
TreeFromNodes/four_nodes_with_limit_8-8                   13.000 ± 0%     6.000 ± 0%  -53.85% (p=0.000 n=10)
TreeFromNodes/large_limit_with_few_nodes_does_not_OOM-8    81.00 ± 0%     40.00 ± 0%  -50.62% (p=0.000 n=10)
geomean                                                               ²               -41.88%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.36%. Comparing base (910092d) to head (a01006c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
- Coverage   89.36%   89.36%   -0.01%     
==========================================
  Files          45       45              
  Lines        7629     7627       -2     
==========================================
- Hits         6818     6816       -2     
  Misses        485      485              
  Partials      326      326              
Components Coverage Δ
dynssz 86.07% <ø> (ø)
dynsszgen 86.87% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sahil-4555
Copy link
Copy Markdown
Contributor Author

Hi, @pk910 Can you please review it when get chance

@pk910
Copy link
Copy Markdown
Owner

pk910 commented Mar 4, 2026

lol, this absolutely makes sense, not sure why this part of the code re-calculated zero hashes on the fly :D
thx for your fix.

@pk910 pk910 merged commit b712168 into pk910:master Mar 4, 2026
17 checks passed
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