Contracts: Only exec parsed code in benchmarks (#3915)

[Weights
compare](https://weights.tasty.limo/compare?unit=weight&ignore_errors=true&threshold=10&method=asymptotic&repo=polkadot-sdk&old=master&new=pg%2Fbench_tweaks&path_pattern=substrate%2Fframe%2F**%2Fsrc%2Fweights.rs%2Cpolkadot%2Fruntime%2F*%2Fsrc%2Fweights%2F**%2F*.rs%2Cpolkadot%2Fbridges%2Fmodules%2F*%2Fsrc%2Fweights.rs%2Ccumulus%2F**%2Fweights%2F*.rs%2Ccumulus%2F**%2Fweights%2Fxcm%2F*.rs%2Ccumulus%2F**%2Fsrc%2Fweights.rs)

Note: Raw weights change does not mean much here, as this PR reduce the
scope of what is benchmarked, they are therefore decreased by a good
margin. One should instead print the Schedule using

cargo test --features runtime-benchmarks bench_print_schedule --
--nocapture
or following the instructions from the
[README](https://github.com/paritytech/polkadot-sdk/tree/pg/bench_tweaks/substrate/frame/contracts#schedule)
for looking at the Schedule of a specific runtime

---------

Co-authored-by: command-bot <>
This commit is contained in:
PG Herveou
2024-04-10 15:05:34 +02:00
committed by GitHub
parent 92e142555d
commit 0d71753e0e
7 changed files with 1659 additions and 2923 deletions
+24
View File
@@ -733,6 +733,30 @@ where
stack.run(executable, input_data).map(|ret| (account_id, ret))
}
#[cfg(feature = "runtime-benchmarks")]
pub fn bench_new_call(
dest: T::AccountId,
origin: Origin<T>,
gas_meter: &'a mut GasMeter<T>,
storage_meter: &'a mut storage::meter::Meter<T>,
schedule: &'a Schedule<T>,
value: BalanceOf<T>,
debug_message: Option<&'a mut DebugBufferVec<T>>,
determinism: Determinism,
) -> (Self, E) {
Self::new(
FrameArgs::Call { dest, cached_info: None, delegated_call: None },
origin,
gas_meter,
storage_meter,
schedule,
value,
debug_message,
determinism,
)
.unwrap()
}
/// Create a new call stack.
fn new(
args: FrameArgs<T, E>,