Skip to content

Commit

Permalink
chore: add nns list proposals benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
mraszyk committed Apr 8, 2024
1 parent 91b9c06 commit 65f33f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rust/bench/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions rust/bench/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,26 @@ fn nns() -> BenchResult {
})
}

#[bench(raw)]
fn nns_proposals() -> BenchResult {
use crate::nns::ListProposalInfoResponse;
let mut config = DecoderConfig::new();
config.set_decoding_quota(COST).set_skipping_quota(SKIP);
let list_proposals_info_response = ListProposalInfoResponse {
proposal_info: vec![],
};
bench_fn(|| {
let bytes = {
let _p = bench_scope("1. Encoding");
Encode!(&list_proposals_info_response).unwrap()
};
{
let _p = bench_scope("2. Decoding");
Decode!([config]; &bytes, ListProposalInfoResponse).unwrap();
}
})
}

#[bench(raw)]
fn extra_args() -> BenchResult {
let mut config = DecoderConfig::new();
Expand Down

0 comments on commit 65f33f3

Please sign in to comment.