-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
``` | ||
|
||
This will output a file `pallet_name.rs` which implements the `WeightInfo` trait you should include |
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.
WeightInfo
is never explained in this doc. I think could use some explanation further up in Writing Benchmarks
section.
/// | name of your pallet's crate (as imported) | ||
/// v v | ||
add_benchmark!(params, batches, pallet_balances, Balances); |
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 there be a #[cfg(feature = "runtime_benchmarks")]
before this?
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.
ehh, its actually already wrapped in a runtime api which has this feature flag.
I have omitted a lot of code here for simplicity, but I think if you find
this text in substrate, it would be clear what to do.
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.
you can let me know otherwise
in your pallet. Each blockchain should generate their own benchmark file with their custom |
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.
This is a bit unclear to me: the file is created in the crate root? Need to be copied into the runtime source file? Or…?
Do we have any tooling available to list un-weighted pallets or dispatchables? Like "test coverage" but for weights.
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.
file will be created in your working directory where you executed the command. It will be a todo feature to support a custom path for the file.
No tools available atm for test coverage of weights. also a good idea for CI
the benchmark. (called "components") | ||
* Executing the benchmark multiple times at each point in order isolate and remove outliers. | ||
* Using the results of the benchmark to create a linear model of the function across its components. |
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.
It means that the results tend to be linear functions of their inputs. For example, if a DB read in a trie of depth 4 takes 100 ns, then we might reasonably expect a depth of 5 to take 125ns, 6 to take 150ns, etc. A nonlinearity would be if a depth of 7 made the read time jump to 280ns.
Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
…aritytech/substrate into shawntabrizi-benchmarking-docs
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.
minor nits
bot merge |
Trying merge. |
* remove test benchmark pallet * docs * finish docs * Update README.md * simplify intro * introduce weight later * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: David <dvdplm@gmail.com> * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/benchmarking/README.md Co-authored-by: David <dvdplm@gmail.com> * Update frame/benchmarking/README.md * Update frame/benchmarking/README.md Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update README.md * Update README.md * Update README.md * Update README.md Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Here are some introductory docs for the
frame_benchmarking
pallet.This is not meant to be a comprehensive tutorial for writing benchmarks, that probably should live outside of this repository, but is meant to go over the high level ideas, and how a user can get started using the benchmarks that already exist.
This PR also removes the
pallet_benchmark
crate which was just a test playground that really shouldn't be here.