-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[zk-token-proof] Add benches for proof instructions #32071
[zk-token-proof] Add benches for proof instructions #32071
Conversation
Codecov Report
@@ Coverage Diff @@
## master #32071 +/- ##
=========================================
- Coverage 81.9% 81.9% -0.1%
=========================================
Files 768 768
Lines 209118 209118
=========================================
- Hits 171387 171357 -30
- Misses 37731 37761 +30 |
@taozhu-chicago, can I ask you for some advise in this PR? I wanted to add the benchmarks that I used test and assign the compute units for the zk-token-proof instructions. The processor for these instructions basically works as follows: Currently, the benchmark code that I added in this PR tests step 1. Zkp's are expensive, so I imagine step 2 above is going to be very small compared to step 1, but do you think the bench also take into account step 2 as well (and CU's updated)? If so, are there examples of benchmarking code that tests native programs copying data into an account? |
I would also assume writing some data into account would have relatively small cost. iirc @alessandrod did bench tests on loading account with different size of data, loading small amount of data (less than few Kilo bytes ?) costs almost nothing; but as data grew larger, the cost increase exponentially. I am not aware of other bench test on native programs copying data to account. |
Had a direct communication with @alessandrod. The cost of storing context data into a specified context data account should be free given that:
For this PR, I will just include the benchmark code. On a follow-up PR, I will address: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add these to CI?
I think if we want to add this one to CI. part1.sh and part2.sh are both okay to be the candidate. their test time are similar. btw, we don't do too much thing to those benchmark results so I don't have too much can share atm. we can add them first and rerog later! |
Okay thanks! I will add them to to the CI. @yihau One question is, does the format of the output of the benches to append to the logs important? The bench scripts in the ci outputs json format, but I can't seem to find that option available with |
sure. afaik banking-bench and accounts-bench are not json output format either. 🪖 |
…roofU128`, `VerifyBatchedRangeProofU256`
the CI part looks good to me 🫶 |
* add bench test for `VerifyPubkeyValidity` * add bench test for `VerifyRangeProofU64` * add bench test for `VerifyWithdraw` * add bench test for `VerifyZeroBalance` * add bench test for `VerifyGroupedCiphertextValidity` * add bench test for `VerifyCiphertextCommitmentEquality` * add bench test for `VerifyCiphertextCiphertextEquality` * add bench test for `VerifyBatchedGroupedCiphertextValidity` * add bench test for `VerifyBatchedRangeProofu64`, `VerifyBatchedRangeProofU128`, `VerifyBatchedRangeProofU256` * add bench test for `VerifyTransfer` and `VerifyTransferWithFee` * use add `criterion` to workspace cargo * add bench to ci
* add bench test for `VerifyPubkeyValidity` * add bench test for `VerifyRangeProofU64` * add bench test for `VerifyWithdraw` * add bench test for `VerifyZeroBalance` * add bench test for `VerifyGroupedCiphertextValidity` * add bench test for `VerifyCiphertextCommitmentEquality` * add bench test for `VerifyCiphertextCiphertextEquality` * add bench test for `VerifyBatchedGroupedCiphertextValidity` * add bench test for `VerifyBatchedRangeProofu64`, `VerifyBatchedRangeProofU128`, `VerifyBatchedRangeProofU256` * add bench test for `VerifyTransfer` and `VerifyTransferWithFee` * use add `criterion` to workspace cargo * add bench to ci
* add bench test for `VerifyPubkeyValidity` * add bench test for `VerifyRangeProofU64` * add bench test for `VerifyWithdraw` * add bench test for `VerifyZeroBalance` * add bench test for `VerifyGroupedCiphertextValidity` * add bench test for `VerifyCiphertextCommitmentEquality` * add bench test for `VerifyCiphertextCiphertextEquality` * add bench test for `VerifyBatchedGroupedCiphertextValidity` * add bench test for `VerifyBatchedRangeProofu64`, `VerifyBatchedRangeProofU128`, `VerifyBatchedRangeProofU256` * add bench test for `VerifyTransfer` and `VerifyTransferWithFee` * use add `criterion` to workspace cargo * add bench to ci
Problem
The instructions for the zk-token-proof program have been assigned compute units, but there is no benchmark tests for these instructions.
Summary of Changes
Added benchmark code for the zk-token-proof program.
Fixes #