vacp2p / zerokit

A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments.
Apache License 2.0
131 stars 7 forks source link

Expose a public function to fetch the root of a subtree at level n #247

Closed seemenkina closed 5 months ago

seemenkina commented 5 months ago

Part of #237

github-actions[bot] commented 5 months ago

Benchmark for 97c8bd3

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | FullMerkleTree::compute_root | 0.0±0.00ns | 0.0±0.00ns | NaN% | | FullMerkleTree::delete | 888.0±18.16ns | 891.1±8.06ns | +0.35% | | FullMerkleTree::get | **3.4±0.04ns** | 3.5±0.06ns | **+2.94%** | | FullMerkleTree::get_subtree_root | 3.6±0.10ns | N/A | N/A | | FullMerkleTree::override_range | 2.2±0.02µs | 2.2±0.02µs | 0.00% | | FullMerkleTree::set | 892.8±11.65ns | 891.6±11.21ns | -0.13% | | OptimalMerkleTree::compute_root | 1034.6±13.28ns | 1038.1±14.85ns | +0.34% | | OptimalMerkleTree::delete | 1051.7±131.88ns | 1044.5±92.77ns | -0.68% | | OptimalMerkleTree::get | 23.4±0.19ns | **22.9±0.83ns** | **-2.14%** | | OptimalMerkleTree::get_subtree_root | 27.1±0.38ns | N/A | N/A | | OptimalMerkleTree::override_range | **5.2±0.07µs** | 5.3±0.29µs | **+1.92%** | | OptimalMerkleTree::set | **1029.5±6.16ns** | 1042.2±57.97ns | **+1.23%** |
github-actions[bot] commented 5 months ago

Benchmark for 97c8bd3

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | FullMerkleTree::::full_height_gen | 15.4±0.13ms | **14.3±0.08ms** | **-7.14%** | | OptimalMerkleTree::::full_height_gen | 564.9±2.62µs | **553.6±7.58µs** | **-2.00%** | | Pmtree::compute_root | 0.0±0.00ns | 0.0±0.00ns | NaN% | | Pmtree::get | **320.9±6.41ns** | 324.4±2.46ns | **+1.09%** | | Pmtree::get_subtree_root | 472.1±4.12ns | N/A | N/A | | Pmtree::override_range | 233.6±3.27µs | 233.9±3.82µs | +0.13% | | Pmtree::set | **54.4±0.84µs** | 56.5±0.60µs | **+3.86%** | | Pmtree:delete | **54.3±0.68µs** | 55.7±0.56µs | **+2.58%** | | Set/FullMerkleTree::::set/1 | 564.4±7.21µs | **555.0±6.45µs** | **-1.67%** | | Set/FullMerkleTree::::set/10 | 5.7±0.02ms | **5.5±0.04ms** | **-3.51%** | | Set/FullMerkleTree::::set/100 | 56.7±0.09ms | **55.8±0.70ms** | **-1.59%** | | Set/FullMerkleTree::::set_range/1 | 564.6±7.64µs | **551.0±7.55µs** | **-2.41%** | | Set/FullMerkleTree::::set_range/10 | 773.5±3.39µs | **758.8±7.45µs** | **-1.90%** | | Set/FullMerkleTree::::set_range/100 | 3.4±0.02ms | **3.3±0.01ms** | **-2.94%** | | Set/OptimalMerkleTree::::set/1 | 566.5±7.03µs | **553.4±5.62µs** | **-2.31%** | | Set/OptimalMerkleTree::::set/10 | 5.7±0.02ms | **5.5±0.03ms** | **-3.51%** | | Set/OptimalMerkleTree::::set/100 | 56.9±0.09ms | **55.7±0.18ms** | **-2.11%** | | Set/OptimalMerkleTree::::set_range/1 | 565.2±8.58µs | **554.0±5.16µs** | **-1.98%** | | Set/OptimalMerkleTree::::set_range/10 | 5.7±0.02ms | **5.6±0.02ms** | **-1.75%** | | Set/OptimalMerkleTree::::set_range/100 | 56.9±0.09ms | **55.7±0.12ms** | **-2.11%** | | zkey::upload_from_folder | 3.3±0.00s | 3.3±0.00s | 0.00% |
seemenkina commented 5 months ago

Of course it doesn't work without this release.

Or we need to make a fork on vac and depend on it while we wait for the release

github-actions[bot] commented 5 months ago

Benchmark for 4f57515

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | FullMerkleTree::compute_root | 0.0±0.00ns | 0.0±0.00ns | NaN% | | FullMerkleTree::delete | 849.2±7.47ns | 849.1±12.25ns | -0.01% | | FullMerkleTree::get | 0.0±0.00ns | 0.0±0.00ns | NaN% | | FullMerkleTree::get_subtree_root | 0.6±0.01ns | N/A | N/A | | FullMerkleTree::override_range | 2.1±0.05µs | 2.1±0.02µs | 0.00% | | FullMerkleTree::set | 850.4±6.91ns | 851.7±12.28ns | +0.15% | | OptimalMerkleTree::compute_root | 990.6±24.79ns | 997.1±9.24ns | +0.66% | | OptimalMerkleTree::delete | **986.1±7.15ns** | 993.9±10.88ns | **+0.79%** | | OptimalMerkleTree::get | 18.5±0.15ns | 18.6±0.29ns | +0.54% | | OptimalMerkleTree::get_subtree_root | 18.6±0.28ns | N/A | N/A | | OptimalMerkleTree::override_range | **4.9±0.06µs** | 5.0±0.08µs | **+2.04%** | | OptimalMerkleTree::set | **988.9±9.02ns** | 1012.8±78.67ns | **+2.42%** |
github-actions[bot] commented 5 months ago

Benchmark for 4f57515

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | FullMerkleTree::::full_height_gen | 15.1±0.19ms | **14.8±0.11ms** | **-1.99%** | | OptimalMerkleTree::::full_height_gen | 543.5±4.09µs | 544.4±4.88µs | +0.17% | | Pmtree::compute_root | 0.0±0.00ns | 0.0±0.00ns | NaN% | | Pmtree::get | 353.4±5.15ns | **335.6±3.73ns** | **-5.04%** | | Pmtree::get_subtree_root | 481.6±6.18ns | N/A | N/A | | Pmtree::override_range | **234.9±5.35µs** | 239.3±3.58µs | **+1.87%** | | Pmtree::set | 54.2±2.42µs | 54.2±2.58µs | 0.00% | | Pmtree:delete | 53.6±0.42µs | 54.0±1.53µs | +0.75% | | Set/FullMerkleTree::::set/1 | 540.9±9.52µs | 545.6±7.36µs | +0.87% | | Set/FullMerkleTree::::set/10 | 5.4±0.03ms | 5.4±0.02ms | 0.00% | | Set/FullMerkleTree::::set/100 | **54.3±0.26ms** | 54.8±0.19ms | **+0.92%** | | Set/FullMerkleTree::::set_range/1 | 541.0±7.91µs | 543.6±5.92µs | +0.48% | | Set/FullMerkleTree::::set_range/10 | 743.2±8.29µs | 744.8±7.46µs | +0.22% | | Set/FullMerkleTree::::set_range/100 | **3.2±0.01ms** | 3.3±0.01ms | **+3.13%** | | Set/OptimalMerkleTree::::set/1 | 544.6±6.46µs | 545.9±10.81µs | +0.24% | | Set/OptimalMerkleTree::::set/10 | **5.4±0.02ms** | 5.5±0.02ms | **+1.85%** | | Set/OptimalMerkleTree::::set/100 | **54.4±0.25ms** | 55.0±0.22ms | **+1.10%** | | Set/OptimalMerkleTree::::set_range/1 | **539.2±5.78µs** | 548.4±7.44µs | **+1.71%** | | Set/OptimalMerkleTree::::set_range/10 | **5.4±0.02ms** | 5.6±0.02ms | **+3.70%** | | Set/OptimalMerkleTree::::set_range/100 | **54.3±0.14ms** | 55.2±0.10ms | **+1.66%** | | zkey::upload_from_folder | 3.3±0.00s | 3.3±0.01s | 0.00% |