Update benchmarking macros (#3934)
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:Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Alexander Theißen <alex.theissen@me.com>
parent
ddb53c87
Showing
- bridges/chains/chain-bridge-hub-rococo/src/lib.rs 1 addition, 1 deletionbridges/chains/chain-bridge-hub-rococo/src/lib.rs
- prdoc/pr_3934.prdoc 11 additions, 0 deletionsprdoc/pr_3934.prdoc
- substrate/frame/alliance/src/weights.rs 520 additions, 513 deletionssubstrate/frame/alliance/src/weights.rs
- substrate/frame/asset-conversion/src/weights.rs 65 additions, 61 deletionssubstrate/frame/asset-conversion/src/weights.rs
- substrate/frame/asset-rate/src/weights.rs 36 additions, 37 deletionssubstrate/frame/asset-rate/src/weights.rs
- substrate/frame/assets/src/weights.rs 428 additions, 417 deletionssubstrate/frame/assets/src/weights.rs
- substrate/frame/bags-list/src/weights.rs 82 additions, 83 deletionssubstrate/frame/bags-list/src/weights.rs
- substrate/frame/balances/src/weights.rs 50 additions, 48 deletionssubstrate/frame/balances/src/weights.rs
- substrate/frame/benchmarking/src/tests.rs 29 additions, 48 deletionssubstrate/frame/benchmarking/src/tests.rs
- substrate/frame/benchmarking/src/utils.rs 104 additions, 2 deletionssubstrate/frame/benchmarking/src/utils.rs
- substrate/frame/benchmarking/src/v1.rs 34 additions, 45 deletionssubstrate/frame/benchmarking/src/v1.rs
- substrate/frame/benchmarking/src/weights.rs 40 additions, 41 deletionssubstrate/frame/benchmarking/src/weights.rs
- substrate/frame/bounties/src/weights.rs 202 additions, 203 deletionssubstrate/frame/bounties/src/weights.rs
- substrate/frame/broker/src/weights.rs 141 additions, 139 deletionssubstrate/frame/broker/src/weights.rs
- substrate/frame/child-bounties/src/weights.rs 190 additions, 191 deletionssubstrate/frame/child-bounties/src/weights.rs
- substrate/frame/collective/src/weights.rs 354 additions, 323 deletionssubstrate/frame/collective/src/weights.rs
- substrate/frame/contracts/src/weights.rs 625 additions, 619 deletionssubstrate/frame/contracts/src/weights.rs
- substrate/frame/conviction-voting/src/weights.rs 212 additions, 193 deletionssubstrate/frame/conviction-voting/src/weights.rs
- substrate/frame/core-fellowship/src/weights.rs 220 additions, 213 deletionssubstrate/frame/core-fellowship/src/weights.rs
- substrate/frame/democracy/src/weights.rs 552 additions, 541 deletionssubstrate/frame/democracy/src/weights.rs
Please register or sign in to comment