Test each benchmark case in own #[test]#9860
Conversation
4ce3a4f to
6a38664
Compare
gui1117
left a comment
There was a problem hiding this comment.
looks good to me once doc about new feature is added
So how does this work? Where do you want it documented? |
I just mean this #9860 (comment) benchmark have a new feature: improved test suite when impl_benchmark_test_suite is written inside the macro. So that needs to be documented in the rust-doc of the item substrate/frame/benchmarking/src/lib.rs Lines 58 to 191 in 0d44d83 |
`another_set_dummy` is not present in the benchmarking.rs (anymore).
|
I wonder if it would be difficult to do a test that ensures those test are correctly generated, maybe by ensuring they fail somewhere, anyway it is fine for now. |
|
bot merge |
|
Trying merge. |
|
Sorry I was late into the game, but I think a follow-up to this would be to figure out a nicer syntax for the |
* master: (67 commits) Downstream `node-template` pull (#9915) Implement core::fmt::Debug for BoundedVec (#9914) Quickly skip invalid transactions during block authorship. (#9789) Add SS58 prefix for Automata (#9805) Clean up sc-peerset (#9806) Test each benchmark case in own #[test] (#9860) Add build with docker section to README (#9792) Simple Trait to Inspect Metadata (#9893) Pallet Assets: Create new asset classes from genesis config (#9742) doc: subkey usage (#9905) Silence alert about large-statement-fetcher (#9882) Fix democracy on-initialize weight (#9890) Fix basic authorship flaky test (#9906) contracts: Add event field names (#9896) subkey readme update on install (#9900) add feature wasmtime-jitdump (#9871) Return `target_hash` for finality_target instead of an Option (#9867) Update wasmtime to 0.29.0 (#9552) Less sleeps (#9848) remove unidiomatic (#9895) ...
|
we could also make it an attribute macro so that people can have the automatic formatting |
|
/tip medium |
|
Please fix the following problems before calling the tip bot again:
|
|
Nice bot! Thanks very much 😄 I added my polkadot address to the MR description. |
|
You deserve it. That was bugging me for some time. |
|
/tip medium |
|
A medium tip was successfully submitted for ucover (13XwRjzNXFGUBwi8uRDU4AgFuTai7rFPRQ9MVA3M7ci8d23r on polkadot). |
Updates the
impl_benchmark_test_suite!and extends thebenchmarks!macros.Closes #9110
Syntax extension
It is now possible to use
impl_benchmark_test_suite!within thebenchmarks!macro.Example:
Behavioural change
When
impl_benchmark_test_suite!is used in abenchmarks!call, it now generates one#[test]function for each bench case.Old output:
New output:
👉
benchmarks!andimpl_benchmark_test_suite!stay backwards compatible.Parallel benchmarks
Since each bench case has its own
#[test]function, it is possible to run them in parallel.A good example is the contracts pallet:
Result with old syntax (after compilation):
cargo test --features=runtime-benchmarks -- --test-threads 16 58,85s user 0,61s system 108% cpu 54,619 totalResult with new syntax (after compilation):
cargo test --features=runtime-benchmarks -- --test-threads 16 65,28s user 0,87s system 264% cpu 24,981 totalOpen points
polkadot address: 13XwRjzNXFGUBwi8uRDU4AgFuTai7rFPRQ9MVA3M7ci8d23r