Skip to content
Snippets Groups Projects
PG Herveou's avatar
PG Herveou authored
Current benchmarking macro returns a closure with the captured
benchmarked code.
This can cause issues when the benchmarked code has complex lifetime
requirements.

This PR updates the existing macro by injecting the recording parameter
and invoking the start / stop method around the benchmarked block
instead of returning a closure

One other added benefit is that you can write this kind of code now as
well:

```rust
let v;
#[block]
{ v = func.call(); }
dbg!(v); // or assert something on v
```


[Weights compare
link](https://weights.tasty.limo/compare?unit=weight&ignore_errors=true&threshold=10&method=asymptotic&repo=polkadot-sdk&old=pg/fix-weights&new=pg/bench_update&path_pattern=substrate/frame/**/src/weights.rs,polkadot/runtime/*/src/weights/**/*.rs,polkadot/bridges/modules/*/src/weights.rs,cumulus/**/weights/*.rs,cumulus/**/weights/xcm/*.rs,cumulus/**/src/weights.rs)

---------

Co-authored-by: command-bot <>
Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@pari...>
d38f6e67

Substrate

GitHub license GitLab Status PRs Welcome Stack Exchange

Substrate is a next-generation framework for blockchain innovation 🚀.

Getting Started

Head to docs.substrate.io and follow the installation instructions. Then try out one of the tutorials. Refer to the Docker instructions to quickly run Substrate, Substrate Node Template, Subkey, or to build a chain spec.

Community & Support

Join the highly active and supportive community on the Substrate Stack Exchange to ask questions about use and problems you run into using this software. Please do report bugs and issues here for anything you suspect requires action in the source.

Contributions & Code of Conduct

Please follow the contributions guidelines as outlined in docs/contributor/CONTRIBUTING.md. In all communications and contributions, this project follows the Contributor Covenant Code of Conduct.

Security

The security policy and procedures can be found in docs/contributor/SECURITY.md.

License

The reason for the split-licensing is to ensure that for the vast majority of teams using Substrate to create feature-chains, then all changes can be made entirely in Apache2-licensed code, allowing teams full freedom over what and how they release and giving licensing clarity to commercial teams.

In the interests of the community, we require any deeper improvements made to Substrate's core logic (e.g. Substrate's internal consensus, crypto or database code) to be contributed back so everyone can benefit.