Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Batch benchmarks together with * notation. #5436

Merged
merged 7 commits into from
Mar 31, 2020
Merged

Conversation

gavofyork
Copy link
Member

@gavofyork gavofyork commented Mar 27, 2020

polkadot companion: paritytech/polkadot#948

@gavofyork gavofyork added A0-please_review Pull request needs code review. B1-clientnoteworthy labels Mar 27, 2020
@gavofyork gavofyork added this to the 2.0 milestone Mar 27, 2020
@gavofyork gavofyork modified the milestones: 2.0, Polkadot Mar 27, 2020
@@ -39,13 +50,13 @@ sp_api::decl_runtime_apis! {
pub trait Benchmark {
/// Dispatch the given benchmark.
fn dispatch_benchmark(
module: Vec<u8>,
extrinsic: Vec<u8>,
pallet: Vec<u8>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pallet: Vec<u8>,
pallet: &[u8],

Shouldn't these also use slice?

Copy link
Member

Choose a reason for hiding this comment

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

These values from from structopt, so I think they will be Vecs.

Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

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

This is great! Tested locally and works well.

I made a PR #5445

Which iterates on this and does the following:

  • Moves the macro to frame_benchmarking
  • Updates the name from pallet! to add_benchmark!
  • Update the syntax and construction of the macro just a little bit to pass the non-local variables to the rust macro.

    Its a little bit nasty, but imo not that bad.

  • Adds some docs.

If you like it, please merge before committing. Else, this is good as is too.

* Move macro into `frame_benchmarking`

* Update docs

* Extra line

* Return error if `batches` is empty
Copy link
Contributor

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

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

Looks good to me

@gavofyork gavofyork merged commit 5f51dd8 into master Mar 31, 2020
@gavofyork gavofyork deleted the gav-fast-benchmarks branch March 31, 2020 13:20
lamafab pushed a commit to lamafab/substrate that referenced this pull request Jun 16, 2020
…aritytech#948)

* Use `add_benchmark` macro

* Return error if `batches` is empty

* Update Cargo.lock

* Companion for paritytech#5463 (paritytech#953)

* Fix test with genesis block 0

* Update Cargo.lock
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants